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

sql: interpret constant NULLs as TEXT when creating a view #84000

Closed
mgartner opened this issue Jul 7, 2022 · 0 comments · Fixed by #85134
Closed

sql: interpret constant NULLs as TEXT when creating a view #84000

mgartner opened this issue Jul 7, 2022 · 0 comments · Fixed by #85134
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team

Comments

@mgartner
Copy link
Collaborator

mgartner commented Jul 7, 2022

CRDB is unable to create a view when there is a untyped, constant NULL column:

defaultdb> CREATE VIEW myview AS SELECT null AS c;
ERROR: value type unknown cannot be used for table columns
SQLSTATE: 42P16

Postgres assumes untyped NULLs have the TEXT type:

marcus=# CREATE VIEW myview AS SELECT null AS c;
CREATE VIEW

marcus=# SELECT c, pg_typeof(c) FROM myview;
  c   | pg_typeof
------+-----------
 NULL | text
(1 row)

Jira issue: CRDB-17399

@mgartner mgartner added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Jul 7, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Jul 7, 2022
@craig craig bot closed this as completed in #85134 Aug 1, 2022
@craig craig bot closed this as completed in 314baa5 Aug 1, 2022
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant