tarantool / tarantool/tarantool
sql: introduce <CREATE TYPE> statement
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the referenced ANSI SQL 11.51 user-defined type definition and the CREATE TYPE and CREATE CAST examples in this issue. No implementation files or tests are named; done means supporting type aliases such as AGE_TYPE AS INTEGER and allowing casts to the alias without changing the original type's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100