On Thu, Nov 30, 2017 at 6:40 AM, Daniel Gustafsson <dan...@yesql.se> wrote: > For reasons unknown to me I had avoided poking in contrib/. Attached patch > handles the additional defname comparisons in contrib that are applicable.
I am having a bit of trouble understanding why the first hunk in DefineAggregate() is taking PARALLEL as a special case. The documentation gives three separate synopses for CREATE AGGREGATE, but parallel appears in all of them, and there are other options that do too, so the comment doesn't really help me understand why it's special as compared to other, similar options. I think the changes in DefineView and ATExecSetRelOptions is wrong, because transformRelOptions() is still using pg_strcasecmp. With the patch: rhaas=# create view v(x) with ("Check_option"="local") as select 1; CREATE VIEW rhaas=# create view v(x) with ("check_option"="local") as select 1; ERROR: WITH CHECK OPTION is supported only on automatically updatable views HINT: Views that do not select from a single table or view are not automatically updatable. Oops. Here are, for the record, examples of SQL that will be generate errors or warnings with the patch, but not presently, with a note about which function got changed at the C level to affect the behavior. transformRelOptions/interpretOidsOption: create table a () with ("OiDs"=true); DefineAggregate, second hunk: CREATE AGGREGATE avg (float8) (sfunc = float8_accum, stype = float8[], finalfunc = float8_avg, initcond = '{0,0,0}', parallel = 'sAfe'); DefineCollation: CREATE COLLATION stunk ("LoCaLeS" = "C"); compute_attributes_with_style: create function one() returns int as $$select 1$$ language sql with ("isStrict" = 'true'); DefineOperator: create operator @ (procedure = pg_catalog.int4eq, leftarg = int4, "RIGHTARG" = int4); DefineType: create type awesome (input = int4in, "OuTpUt" = int4out); validateWithCheckOption: create table t(a int, b text, unique(a)); create view x with (check_option = 'loCal') as select * from t; I have not yet managed to figure out what the impact of the contrib changes, or the text search changes in core, is. This is partly a lack of subject matter expertise, but the fact that the functions being modified in contrib have a grand total of 0 lines of comments between them does not help. That's not this patch's fault, nor this patch's job to fix, but it is a barrier to understanding. I think it would be nice to have a complete list of examples of what syntax this patch is affecting. I am actually pretty dubious that we want to do this. I found one bug already (see above), and I don't think there's any guarantee that it's the only one, because it's pretty hard to be sure that none of the remaining calls to pg_strcasecmp are being applied to any of these values in some other part of the code. I'm not sure that the backward compatibility issue is a huge deal, but from my point of view this carries a significant risk of introducing new bugs, might annoy users who spell any of these keywords in all caps with surrounding quotation marks, and really has no clear benefit that I can see. The originally-offered justification is that making this consistent would help us avoid subtle bugs, but it seems at least as likely to CREATE subtle bugs, and the status quo is AFAICT harming nobody. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company