Re: [HACKERS] Fetch JSONB Value for UNIQUE Constraint

2017-03-24 Thread David E. Wheeler
On Mar 24, 2017, at 5:00 PM, Peter Geoghegan wrote: >> So it’s a fine workaround, but maybe there’s something missing from the >> parsing of the CREATE TABLE statement? This is on 9.6.1. > > Unique constraints don't support expressions, or a predicate (partial-ness). Oh. Okay. I assumed the sy

Re: [HACKERS] Fetch JSONB Value for UNIQUE Constraint

2017-03-24 Thread Peter Geoghegan
On Fri, Mar 24, 2017 at 4:57 PM, David E. Wheeler wrote: > So it’s a fine workaround, but maybe there’s something missing from the > parsing of the CREATE TABLE statement? This is on 9.6.1. Unique constraints don't support expressions, or a predicate (partial-ness). -- Peter Geoghegan -- S

[HACKERS] Fetch JSONB Value for UNIQUE Constraint

2017-03-24 Thread David E. Wheeler
Dear Hackers, Should this work? CREATE TABLE things ( user_id INTEGER NOT NULL, document JSONB NOT NULL, UNIQUE (user_id, document->>'name') ); ERROR: syntax error at or near "->>" LINE 4: UNIQUE (user_id, document->>’name') I tried adding parens,