yugabyte-db
yugabyte-db copied to clipboard
BUGFIX: Add proper error messages when indexing a column in YSQL
Add proper error messages when indexing a column in YSQL
resolves issue https://github.com/yugabyte/yugabyte-db/issues/23244
- This is to add proper error messages for the data types supported in YSQL. Currently there are a lot of data types which, when converted to a string, returns the default "user_defined_type"
- I have re-compiled the project with my changes and tested these commands in ysql terminal
- All existing tests are passing
- The missing data types were taken from yb_type.c
- I’ve added my DCO signoff at the project’s request. There are no other changes
- I’ve squashed and rebased this branch. There are no other changes
Test script
- This was ran on my branch and the error messages came through as expected
- please find below sample terminal output showing the error messages, as well as the sql script used to get those test results.
-- create an empty table with updated data types
CREATE TABLE types (
test_smgr smgr
,test_name name[]
,test_int2vector int2vector[]
-- Transactions and Identifiers
,test_xid xid[]
,test_tid tid[]
-- System info functions
,test_aclitem aclitem[]
-- Built-in general purpose Types
,test_txid_snapshot txid_snapshot
,test_txid_snapshot_arr txid_snapshot[]
,test_tsvector tsvector[]
,test_tsquery tsquery[]
,test_gtsvector gtsvector[]
,test_pg_lsn pg_lsn[]
,test_bit bit[]
,test_varbit varbit[]
-- Byte Types
,test_bytea bytea[]
-- Boolean Types
,test_bool bool[]
-- JSON types
,test_json json[]
,test_jsonb jsonb[]
,test_xml xml[]
-- Network Address Types
,test_cidr cidr
,test_cidr_arr cidr[]
,test_inet inet[]
,test_macaddr macaddr[]
,test_macaddr8 macaddr8[]
-- UUID Types
,test_uuid uuid[]
-- Range Types
,test_int4range int4range[]
,test_int8range int8range
,test_int8rangearr int8range[]
,test_numrange numrange
,test_numrangearr numrange[]
,test_tsrange tsrange
,test_tsrangearr tsrange[]
,test_tstzrange tstzrange
,test_tstzrangearr tstzrange[]
,test_daterange daterange
,test_daterangearr daterange[]
-- Date/Time Types: https://www.postgresql.org/docs/current/datatype-datetime.html
,test_date date[]
,test_time time[]
,test_timestamp timestamp[]
,test_timetz timetz[]
,test_timestamptz timestamptz[]
,test_tinterval tinterval[]
,test_abstime abstime[]
,test_reltime reltime[]
-- Character Types
,test_char char[]
,test_varchar varchar[]
-- Numeric Types
,test_int8 int8[]
,test_numeric numeric[]
,test_float8 float8[]
-- Monetary Types
,test_money money[]
-- Geometric Types: https://www.postgresql.org/docs/current/datatype-geometric.html
,test_point point[]
,test_line line[]
,test_lseg lseg[]
,test_box box[]
,test_path path[]
,test_polygon polygon[]
,test_circle circle[]
-- Object Identifier Types: https://www.postgresql.org/docs/current/datatype-oid.html
,test_regclass regclass[]
,test_regconfig regconfig[]
,test_regdictionary regdictionary[]
,test_regnamespace regnamespace[]
,test_regoper regoper[]
,test_regoperator regoperator[]
,test_regproc regproc[]
,test_regprocedure regprocedure[]
,test_regrole regrole[]
,test_regtype regtype[]
);
-- try create an index on those columns to provoke the error
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_sm);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_name);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_int2vector);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_xid);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tid);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_aclitem);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_txid_snapsh);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_txid_snapshot);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tsvector);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tsquery);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_gtsvector);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_pg_lsn);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_bit);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_varbit);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_bytea);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_bool);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_json);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_jsonb);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_xml);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_ci);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_cidr);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_inet);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_macaddr);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_macaddr8);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_uuid);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_int4range);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_int8ran);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_int8range);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_numran);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_numrange);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tsran);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tsrange);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tstzran);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tstzrange);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_dateran);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_daterange);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_date);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_time);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_timestamp);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_timetz);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_timestamptz);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_tinterval);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_abstime);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_reltime);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_char);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_varchar);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_int8);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_numeric);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_float8);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_money);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_point);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_line);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_lseg);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_box);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_path);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_polygon);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_circle);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regclass);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regconfig);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regdictionary);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regnamespace);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regoper);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regoperator);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regproc);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regprocedure);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regrole);
CREATE UNIQUE INDEX index_types_on_test_ids ON public.types (test_regtype);
Deploy Preview for infallible-bardeen-164bc9 ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | e84e4986095dcfe0446a564e1f6650418bfa7e82 |
| Latest deploy log | https://app.netlify.com/sites/infallible-bardeen-164bc9/deploys/66cee60dc89c25000866f7c0 |
| Deploy Preview | https://deploy-preview-23691--infallible-bardeen-164bc9.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@GarbhanK did you sign the CLA?
@GarbhanK did you sign the CLA?
Hey @ddorian, I'm just waiting on approval from my organisation before I sign. Should just be another day or two.
@GarbhanK did you sign the CLA?
@ddorian I got internal approval and the CLA has been signed, PR is ready for review.
Hi @GarbhanK
I'm sorry, but looks like this issue is fixed by PostgreSQL 15 merge that we just finished last week https://github.com/yugabyte/yugabyte-db/commit/55782d561e55ef972f2470a4ae887dd791bb4a97 (2 years in the making).
Please try to get an approval from us before starting to work on an issue because someone else may be working on it, or your design may be incorrect, or an upgrade will make it obsolete like in this case.
In this pull request, you only needed to add some tests using a pg regress file for these specific errors and it would be complete.