From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Pass ParseState as down to utility functions. |
Date: | 2024-11-30 12:36:00 |
Message-ID: | CACJufxFp+WQenhLuK31hVvEJRi7o1sE3kCtVidP-JpqTeTu7fw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi.
ATExecAddOf
DefineType
ATPrepAlterColumnType
ATExecAlterColumnType
DefineDomain
AlterType
i changed the above function, so the above related function errors may
print out error position.
reason for change mainly because these functions have
`typenameType(NULL, typeName, &targettypmod);`
we want to pass not NULL pstate (typenameType(pstate, typeName, &targettypmod);)
why do we want printout error position
1. it can quickly locate DDL command error positions, beginner friendly.
2. in the thread `CREATE SCHEMA ... CREATE DOMAIN support`, case like:
CREATE SCHEMA regress_schema_2
create domain ss1 as ss
create domain ss as text;
ERROR: type "ss" does not exist
obviously the error is not helpful at all.
As you can see, in cases like a single DDL, multiple sub DDL within
it, error position is quite important
I also added some tests for DefineDomain.
added parser_errposition for many places in DefineDomain.
the attached patch (based on Kirill Reshke 's v2 patch)
either passing the source_string to the existing ParseState
or by making a new ParseState passing source_string to it.
then add
`parser_errposition(pstate, location)))`
in various places optionally.
So I guess bundling it into a single patch should be fine?
Attachment | Content-Type | Size |
---|---|---|
v3-0001-print-out-error-position-for-some-DDL-command.patch | text/x-patch | 19.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bernd Helmle | 2024-11-30 13:14:26 | Re: [PATCH] Add sortsupport for range types and btree_gist |
Previous Message | jian he | 2024-11-30 12:22:00 | speedup ALTER TABLE ADD CHECK CONSTRAINT. |