Re: Rejecting redundant options in Create Collation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Rejecting redundant options in Create Collation
Date
Msg-id 1221644.1601654878@sss.pgh.pa.us
Whole thread Raw
In response to Re: Rejecting redundant options in Create Collation  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
"Daniel Verite" <daniel@manitou-mail.org> writes:
> Assuming we agree that redundant options should consistently
> raise an error for a certain class of statements, could it be handled
> at the grammar level?

I don't think this'd be a great idea.  The grammar would have to
do something pretty brute-force to check for duplication, whereas
the individual statements typically know already whether they've
seen an instance of a particular option.

It will be kind of annoying to make similar changes in every statement,
agreed.  I wonder if there'd be any value in trying to make a subroutine
that deconstructs a DefElem list according to a provided list of option
names, allowing centralized handling of unknown-option and
duplicate-option cases, and maybe sharing handling of the simpler cases
such as boolean and integer options.  I'm not quite sure what the output
ought to look like though.  Some sort of statement-specific struct would
be really ideal, but C doesn't make that easy.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Error code missing for "wrong length of inner sequence" error
Next
From: Peter Eisentraut
Date:
Subject: Re: Dumping/restoring fails on inherited generated column