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: introduce <CREATE TYPE> statement #3837

Open
Korablev77 opened this issue Nov 26, 2018 · 1 comment
Open

sql: introduce <CREATE TYPE> statement #3837

Korablev77 opened this issue Nov 26, 2018 · 1 comment
Labels
Milestone

Comments

@Korablev77
Copy link
Contributor

ANSI SQL allows to create user-defined types. See 11.51 <user-defined type definition>.
Nevertheless, Tarantool doesn't support this feature yet, but we can use this statement at least for creating type aliases:
CREATE TYPE AGE_TYPE AS INTEGER;

This feature may be useful taking into consideration user-defined CAST operator: if user wants to use custom casting rules, but don't want to break it for all usages of given type, one can create alias for that type and define CAST operator.

For instance, user is willing to ban conversion from FLOAT to INT:

CREATE TYPE NEW_INT AS INTEGER;
CREATE CAST (float AS NEW_INT) WITH FUNCTION new_int_cast(NEW_INT) AS ASSIGNMENT;

In this example new_int_cast() function would throw error indicating the fact that conversion is not allowed.

@kyukhin kyukhin added this to the 2.2.0 milestone Dec 7, 2018
@kyukhin kyukhin modified the milestones: 2.2.0, 2.3.0 Mar 27, 2019
@pgulutzan
Copy link
Contributor

This looks like it might solve part of an earlier request, #465 User defined types.

@kyukhin kyukhin modified the milestones: 2.3.1, 2.4.0 Aug 6, 2019
@kyukhin kyukhin modified the milestones: 2.4.1, 2.5.1 Jan 23, 2020
@kyukhin kyukhin modified the milestones: 2.5.1, 2.6.1 Apr 10, 2020
@kyukhin kyukhin modified the milestones: 2.6.1, wishlist Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants