Re: [GENERAL] unique index on embedded json object

2014-09-21 Thread Peter Geoghegan
On Sun, Sep 21, 2014 at 5:23 AM, Lee Jason wrote: > {"id": "12345", > "bags": [{ > "sku": "abc123", > "price": 0, > }, > { > "sku": "abc123", > "price": 0, > }] > } That's invalid JSON - there are stray commas. > However, I want sku of bags to be unique. It means the json can't

Re: [GENERAL] unique index on embedded json object

2014-09-21 Thread John R Pierce
On 9/21/2014 5:23 AM, Lee Jason wrote: > * > * > Any suggestions, please? Thank you. store your structured data in conventional SQL tables. -- john r pierce 37N 122W somewhere on the middle of the left coast

[GENERAL] unique index on embedded json object

2014-09-21 Thread Lee Jason
Hi forks, I am testing postgresql 9.4 beta2 right now. I am wondering if it is possible to create a unique index on embedded json object? For example, I create a table names "products" CREATE TABLE products (oid serial primary key, data jsonb) Now, I try to insert json object into data column.