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: support user-defined types #25123

Open
2 of 5 tasks
Tracked by #33441
knz opened this issue Apr 27, 2018 · 2 comments
Open
2 of 5 tasks
Tracked by #33441

sql: support user-defined types #25123

knz opened this issue Apr 27, 2018 · 2 comments
Labels
A-sql-datatypes SQL column types usable in table descriptors. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community X-anchored-telemetry The issue number is anchored by telemetry references.

Comments

@knz
Copy link
Contributor

knz commented Apr 27, 2018

ie. CREATE TYPE T AS ... and CREATE DOMAIN T AS

Multiple variants:

Special note:

Whenever a user-defined type is created (with CREATE TYPE), PostgreSQL automatically creates an associated array type, whose name consists of the element type's name prepended with an underscore, and truncated if necessary to keep it less than NAMEDATALEN bytes long. (If the name so generated collides with an existing type name, the process is repeated until a non-colliding name is found.) This implicitly-created array type is variable length and uses the built-in input and output functions array_in and array_out. The array type tracks any changes in its element type's owner or schema, and is dropped if the element type is.

Jira issue: CRDB-5728

@knz knz added A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community labels Apr 27, 2018
@knz knz mentioned this issue Apr 27, 2018
3 tasks
@knz knz added C-wishlist A wishlist feature. and removed C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) labels May 2, 2018
@tlvenn
Copy link
Contributor

tlvenn commented May 14, 2018

One user defined type that is super common with Postgres is the Money compound type, defined as such:

CREATE TYPE public.money_with_currency AS (currency_code char(3), amount decimal);

It would be super useful to be able to define this with CRDB.

@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-datatypes SQL column types usable in table descriptors. and removed C-wishlist A wishlist feature. labels May 14, 2018
@ketzacoatl
Copy link

Support for CREATE DOMAIN / domain types (#27796) is necessary for CockroachDB to be available to haskell web services written with the Yesod web framework.

@knz knz added the X-anchored-telemetry The issue number is anchored by telemetry references. label Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-datatypes SQL column types usable in table descriptors. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community X-anchored-telemetry The issue number is anchored by telemetry references.
Projects
None yet
Development

No branches or pull requests

3 participants