Re: Pass ParseState as down to utility functions.

2025-01-26 Thread Michael Paquier
On Fri, Dec 27, 2024 at 03:01:58PM +0800, jian he wrote: > please check attached for changes within ATPrepAlterColumnType Sorry for the late reply. This is more complete. Two strings are more complex after doing the coerce_to_target_type(), but honestly I am not these are worth having a parser_e

Re: Pass ParseState as down to utility functions.

2024-12-26 Thread jian he
On Wed, Dec 25, 2024 at 5:29 PM Michael Paquier wrote: > > On Mon, Dec 16, 2024 at 05:25:45PM +0800, jian he wrote: > > i've split into 3 patches, feel free to merge them in any way. > > v12-0001: add error position for ATPrepAlterColumnType. > > For this one, why don't you do the same for undefi

Re: Pass ParseState as down to utility functions.

2024-12-25 Thread Michael Paquier
On Mon, Dec 16, 2024 at 05:25:45PM +0800, jian he wrote: > i've split into 3 patches, feel free to merge them in any way. > v12-0001: add error position for ATPrepAlterColumnType. For this one, why don't you do the same for undefined columns and USING with generated columns at least? This looks

Re: Pass ParseState as down to utility functions.

2024-12-16 Thread jian he
On Mon, Dec 16, 2024 at 2:15 PM Michael Paquier wrote: > > -likeType = typenameType(NULL, defGetTypeName(likeTypeEl), NULL); > +likeType = typenameType(pstate, defGetTypeName(likeTypeEl), NULL); > > The only test impacted by this change is the CREATE TYPE (LIKE) in > float8. It se

Re: Pass ParseState as down to utility functions.

2024-12-15 Thread Michael Paquier
On Thu, Dec 12, 2024 at 12:38:06PM +0800, jian he wrote: > I am using DefineDomain(ParseState *pstate, CreateDomainStmt *stmt) for now. > we can also pass querystring or another struct. All the changes in the alternate outputs for collate are always tricky to track. As far as I can see, you've no

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread jian he
On Thu, Dec 12, 2024 at 10:29 AM Michael Paquier wrote: > > I think that the patch should be split a bit more. Even if different > areas of the code are touched, there's more than one idea of how to > create this information for the error position, so each piece could be > committed separately wi

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread jian he
On Thu, Dec 12, 2024 at 4:48 AM Tom Lane wrote: > > jian he writes: > > add parser_errposition to some places in > > transformTableConstraint, transformColumnDefinition > > where v8 didn't. > > I'm not loving the idea of cons'ing up ParseStates in random places in > tablecmds.c. I think we ought

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread Michael Paquier
On Thu, Dec 12, 2024 at 10:08:04AM +0800, jian he wrote: > On Thu, Dec 12, 2024 at 4:48 AM Tom Lane wrote: >> I'm not loving the idea of cons'ing up ParseStates in random places in >> tablecmds.c. I think we ought to fix things so that the one made in >> standard_ProcessUtility is passed down to

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread Michael Paquier
On Tue, Dec 10, 2024 at 10:38:41PM +0800, jian he wrote: > add parser_errposition to some places in > transformTableConstraint, transformColumnDefinition > where v8 didn't. I've looked at the new tests in 0001. Here are some notes. And I've found some mistakes and simplifications on the way. C

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread Tom Lane
jian he writes: > add parser_errposition to some places in > transformTableConstraint, transformColumnDefinition > where v8 didn't. I'm not loving the idea of cons'ing up ParseStates in random places in tablecmds.c. I think we ought to fix things so that the one made in standard_ProcessUtility i

Re: Pass ParseState as down to utility functions.

2024-12-10 Thread jian he
add parser_errposition to some places in transformTableConstraint, transformColumnDefinition where v8 didn't. From b49e1b74b5d479b854599c0f9d6b6df1e61aa67c Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 10 Dec 2024 22:36:45 +0800 Subject: [PATCH v9 2/2] Print out error position for number of DD

Re: Pass ParseState as down to utility functions.

2024-12-10 Thread Kirill Reshke
On Tue, 10 Dec 2024 at 08:28, Michael Paquier wrote: > I would suggest to split the patch into two pieces for clarity, based > on the fact that your v7 patch is doing more than one thing at the > same time: > - Introduce new tests for the new coverage (domain, CREATE TABLE OF, > ALTER TABLE flavo

Re: Pass ParseState as down to utility functions.

2024-12-09 Thread Michael Paquier
On Mon, Dec 09, 2024 at 12:50:20PM +0500, Kirill Reshke wrote: > Should be fixed in v7. +create domain d_fail as int4 constraint cc check(values > 1) deferrable; +ERROR: specifying constraint deferrability not supported for domains +LINE 1: ...in d_fail as int4 constraint cc check(values > 1) def

Re: Pass ParseState as down to utility functions.

2024-12-09 Thread Kirill Reshke
Thank you for reviewing this! On Fri, 6 Dec 2024 at 19:01, Alvaro Herrera wrote: > I think it would make more sense to write the commit message in terms of > the DDL commands that now report error position, than the C functions. > Such a list of commands does not need to be exhaustive; a > repres

Re: Pass ParseState as down to utility functions.

2024-12-06 Thread Alvaro Herrera
On 2024-Dec-06, jian he wrote: > From 6bf657c3b62b7460b317c42ce2f4fa0988acf1a0 Mon Sep 17 00:00:00 2001 > From: jian he > Date: Fri, 6 Dec 2024 16:37:18 +0800 > Subject: [PATCH v6 1/1] print out error position for some DDL command > > doing this by passing the source_string to the existing Parse

Re: Pass ParseState as down to utility functions.

2024-12-06 Thread jian he
hi. extensive test for ATExecAddOf DefineType ATPrepAlterColumnType ATExecAlterColumnType DefineDomain AlterType transformAlterTableStmt only AlterType, ATExecAlterColumnType function code change no tests. AlterType doesn't have location info, can not print it out. ATExecAlterColumnType is unreac

Re: Pass ParseState as down to utility functions.

2024-12-05 Thread Kirill Reshke
Looks like v4 fails on windows, PFA v5. Sorry for the noise, I hope Cirrus CI will like this version. -- Best regards, Kirill Reshke v5-0001-print-out-error-position-for-some-DDL-command.patch Description: Binary data

Re: Pass ParseState as down to utility functions.

2024-12-05 Thread Kirill Reshke
On Thu, 5 Dec 2024 at 11:45, Michael Paquier wrote: > > On Wed, Dec 04, 2024 at 03:31:47PM +0500, Kirill Reshke wrote: > > On Sat, 30 Nov 2024 at 17:37, jian he wrote: > >> So I guess bundling it into a single patch should be fine? > > > > Ok. I created CF entry for this patch. > > > > [0] https:

Re: Pass ParseState as down to utility functions.

2024-12-04 Thread Michael Paquier
On Wed, Dec 04, 2024 at 03:31:47PM +0500, Kirill Reshke wrote: > On Sat, 30 Nov 2024 at 17:37, jian he wrote: >> So I guess bundling it into a single patch should be fine? > > Ok. I created CF entry for this patch. > > [0] https://commitfest.postgresql.org/51/5420/ Note that v3 of the patch is

Re: Pass ParseState as down to utility functions.

2024-12-04 Thread Kirill Reshke
On Sat, 30 Nov 2024 at 17:37, jian he wrote: > So I guess bundling it into a single patch should be fine? Ok. I created CF entry for this patch. [0] https://commitfest.postgresql.org/51/5420/ -- Best regards, Kirill Reshke

Re: Pass ParseState as down to utility functions.

2024-11-30 Thread jian he
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 wan

Pass ParseState as down to utility functions.

2024-11-28 Thread Kirill Reshke
Hi hackers! PFA patch fixing a number of places where typenameType called with NULL pstate. === motivation. Per discussion in a nearby thread for `CREATE SCHEMA ... CREATE DOMAIN support`. Suggested by Jian He & Tom Lane. On Thu, 28 Nov 2024 at 10:52, Tom Lane wrote: > > Kirill Reshke writes: