On 2015-04-23 14:34:02 +0100, Geoff Winkless wrote: > > A syntax error. DO is a reserved keyword. Update is just unreserved (and > > thus can be used as a column label). Ignore is unreserved with the patch > > and was unreserved before. We obviously can make both reserved, but of so > > we have to do it for real, not by hiding the conflicts > > > > Sorry, I misunderstood: so it's not the fact that it can't be used as a > column label (because it can) but the fact that it can't then be referenced > within a WHERE clause without quoting
Meh. You can use any keyword in quotes - because then they're not keywords anymore. > INSERT INTO mytable (somevalue) VALUES (999) ON CONFLICT ('myindex') WHERE > update UPDATE update=1 > > but I would have to do > > INSERT INTO mytable (somevalue) VALUES (999) ON CONFLICT ('myindex') WHERE > "do" UPDATE "do"=1 Yes. > Maybe I'm misreading it, but isn't index_predicate meant to be inside the > brackets? > > http://postgres-benchmarks.s3-website-us-east-1.amazonaws.com/on-conflict-docs/sql-insert.html That has changed since. And for good reason: It's pretty to have the WHERE clause inside the brackets when that's not the case for CREATE INDEX. But more importantly with multiple columns for stuff like ON CONFLICT (a, b WHERE foo) it's unclear where the WHERE is actually attached to. We have that problem with aggregates and it repeatedly caused confusion. > As I said, it's my personal belief that anyone using keywords (of any > kind) unquoted deserves what they get, but I see your point. Given that IGNORE isn't even a keyword right now (9.5 master) that policy isn't particularly meaningful anyway. > I think I object to the fact that you're talking about adding extra > syntactic sugar to work around a parser-implementation problem, not an > actual syntax problem (since UPDATE SET is unambiguous, isn't it?). I fail to see the point of such an objection. We have an LALR parser (generated by bison). That implies a certain expressiveness. You're suggesting that we change to a different kind of parser? I don't think it's necessarily unambiguous. I'm not particularly motivated to prove it though - the point is that we rely on bison to prevent ambiguities. That only works if we're listening. And not if we're silencing warnings about ambiguities over the whole grammar. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers