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

Composite types can be null #763

Open
0xBigBoss opened this issue Apr 24, 2024 · 0 comments
Open

Composite types can be null #763

0xBigBoss opened this issue Apr 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@0xBigBoss
Copy link

0xBigBoss commented Apr 24, 2024

Bug report

Describe the bug

This PR introduced support for composite types, #459. However, composite type fields can be null.

The syntax is comparable to CREATE TABLE, except that only field names and types can be specified; no constraints (such as NOT NULL) can presently be included. Note that the AS keyword is essential; without it, the system will think a different kind of CREATE TYPE command is meant, and you will get odd syntax errors. 1

Composite type declaration field type values then should output with a | null.

An aside: it would also be nice to have support for domains, currently they are generated as unknown type.

drop type t;

create domain notnullint as int not null;

create type t as (a int, b notnullint);

select (1,2)::t;
-- (1,2)

select (1,null)::t;
-- [2024-04-24 09:54:44] [23502] ERROR: domain notnullint does not allow null values
Screenshot 2024-04-24 at 09 57 34

Footnotes

  1. https://www.postgresql.org/docs/15/rowtypes.html#ROWTYPES-DECLARING

@0xBigBoss 0xBigBoss added the bug Something isn't working label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant