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

BUGFIX: Add proper error messages when indexing a column in YSQL #23691

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GarbhanK
Copy link

Add proper error messages when indexing a column in YSQL

resolves issue #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.

yb_finalbranch_testrun

-- 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);

commit c331b5a1577c258ae7656d37eabbafe55fb95ed1
Author: Kenneally, Garbhan <[email protected]>
Date:   Wed Jul 24 16:42:44 2024 +0100

    missed semicolon and typo

    Signed-off-by: Kenneally, Garbhan <[email protected]>

commit 148cfb3de40739d0da532434cd76013f876a481b
Author: Kenneally, Garbhan <[email protected]>
Date:   Wed Jul 24 14:20:14 2024 +0100

    added missing types to YBPgTypeOidToStr func

    Signed-off-by: Kenneally, Garbhan <[email protected]>

Signed-off-by: Kenneally, Garbhan <[email protected]>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

netlify bot commented Aug 28, 2024

Deploy Preview for infallible-bardeen-164bc9 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e84e498
🔍 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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ddorian
Copy link
Contributor

ddorian commented Sep 2, 2024

@GarbhanK did you sign the CLA?

@GarbhanK
Copy link
Author

GarbhanK commented Sep 2, 2024

@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.

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.

3 participants