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

support explicit cast to domain type #997

Merged
merged 9 commits into from
Dec 9, 2024
Merged

Conversation

jennifersp
Copy link
Contributor

@jennifersp jennifersp commented Nov 21, 2024

Regressed tests are tables used as type for casting, which was not supported. The insert statement that makes use of it fails currently. It will be supported as an extension after upcoming CREATE TYPE composite type support.

Copy link
Contributor

github-actions bot commented Nov 21, 2024

Main PR
covering_index_scan_postgres 375.64/s 377.75/s +0.5%
index_join_postgres 153.10/s 153.76/s +0.4%
index_join_scan_postgres 185.09/s 184.97/s -0.1%
index_scan_postgres 12.55/s 12.41/s -1.2%
oltp_point_select 2834.51/s 2830.46/s -0.2%
oltp_read_only 1909.32/s 1900.69/s -0.5%
select_random_points 113.10/s 112.91/s -0.2%
select_random_ranges 144.01/s 144.21/s +0.1%
table_scan_postgres 12.09/s 12.00/s -0.8%
types_table_scan_postgres 5.63/s 5.62/s -0.2%

Copy link
Contributor

github-actions bot commented Nov 21, 2024

Main PR
Total 42090 42090
Successful 15168 15175
Failures 26922 26915
Partial Successes1 5229 5233
Main PR
Successful 36.0371% 36.0537%
Failures 63.9629% 63.9463%

${\color{red}Regressions (3)}$

alter_table

QUERY:          create table at_tab2 (x int, y text, check((x,y)::at_tab1 = (1,'42')::at_tab1));
RECEIVED ERROR: type "at_tab1" does not exist (errno 1105) (sqlstate HY000)
QUERY:          create table at_tab1 (a int, b text) partition by list(a);
RECEIVED ERROR: table with name at_tab1 already exists (errno 1105) (sqlstate HY000)

inherit

QUERY:          select NULL::derived::base;
RECEIVED ERROR: type "derived" does not exist (errno 1105) (sqlstate HY000)

${\color{lightgreen}Progressions (11)}$

domain

QUERY: SELECT cast('12345' as domainvarchar);
QUERY: SELECT cast('1' as dnotnull);
QUERY: SELECT cast(NULL as dnotnull);
QUERY: SELECT cast(cast(NULL as dnull) as dnotnull);
QUERY: select null::inotnull;

psql

QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('zero', '25'::pg_catalog.oid, -1),('one', '23'::pg_catalog.oid, -1),('two', '1700'::pg_catalog.oid, -1),('three', '25'::pg_catalog.oid, -1),('four', '25'::pg_catalog.oid, -1),('five', '701'::pg_catalog.oid, -1),('six', '1043'::pg_catalog.oid, 8),('now', '1082'::pg_catalog.oid, -1)) s(name, tp, tpm)
QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('first', '23'::pg_catalog.oid, -1),('second', '23'::pg_catalog.oid, -1)) s(name, tp, tpm)
QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('QUERY PLAN', '25'::pg_catalog.oid, -1)) s(name, tp, tpm)
QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('x', '23'::pg_catalog.oid, -1),('?column?', '25'::pg_catalog.oid, -1),('y', '23'::pg_catalog.oid, -1),( E'dirty\\name', '16'::pg_catalog.oid, -1)) s(name, tp, tpm)
QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('x', '23'::pg_catalog.oid, -1),('?column?', '25'::pg_catalog.oid, -1),('y', '23'::pg_catalog.oid, -1),( E'dirty\\name', '16'::pg_catalog.oid, -1)) s(name, tp, tpm)
QUERY: SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"
FROM (VALUES ('three', '23'::pg_catalog.oid, -1),('four', '23'::pg_catalog.oid, -1)) s(name, tp, tpm)

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

Copy link
Collaborator

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

server/expression/explicit_cast.go Outdated Show resolved Hide resolved
server/analyzer/resolve_type.go Show resolved Hide resolved
Base automatically changed from jennifer/type-changes to main December 6, 2024 19:23
@jennifersp jennifersp changed the title support cast to domain type support explicit cast to domain type Dec 6, 2024
@jennifersp jennifersp merged commit 6241d34 into main Dec 9, 2024
14 checks passed
@jennifersp jennifersp deleted the jennifer/domain-cast branch December 9, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants