Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Postgres): support nested domain types #3641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joeydewaal
Copy link
Contributor

This PR adds support for nested domain types. When comparing a PgType by Oid it compares the Oid of the base type when it is a domain.

@zacknewman
Copy link

zacknewman commented Feb 6, 2025

Does this PR only address DOMAINs that are transitively based on a "primitive" (e.g., a DOMAIN of a DOMAIN of integer)? If not, then there should be a test added for the case where you have a composite type that has a DOMAIN field that is based on a composite type that has a "primitive" field. For example a test that fetches the row in buzz based on the below query:

BEGIN;
    CREATE TYPE foo AS (x integer);
    CREATE DOMAIN bar AS foo NOT NULL;
    CREATE TYPE fizz AS (y bar);
    CREATE TABLE buzz(z fizz NOT NULL);
    INSERT INTO buzz VALUES (ROW(ROW(1)));
COMMIT;

There is a bug in how FromSql is derived in postgres_types that was not triggered until such a test was added. If this PR does not intend to support such situations, then it may make sense to rename the PR to make it clear that only transitive "primitive" DOMAIN support is being added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants