Re: [GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread Adrian Klaver
On 08/22/2016 06:23 PM, Tom Lane wrote: Adrian Klaver writes: On 08/17/2016 11:02 PM, Silk Parrot wrote: CREATE TABLE user ( uuid UUID PRIMARY KEY DEFAULT public.uuid_generate_v4(), google_user system.google_user, facebook_user system.facebook_user, UNIQUE

Re: [GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread Tom Lane
Adrian Klaver writes: > On 08/17/2016 11:02 PM, Silk Parrot wrote: >> CREATE TABLE user ( >> uuid UUID PRIMARY KEY DEFAULT public.uuid_generate_v4(), >> google_user system.google_user, >> facebook_user system.facebook_user, >> UNIQUE (google_user.email) >> ); >> ERROR:

Re: [GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread Adrian Klaver
On 08/17/2016 11:02 PM, Silk Parrot wrote: Hi, I am trying to model a social login application. The application can support multiple login providers. I am thinking of creating a custom type for each provider. e.g. CREATE TYPE system.google_user AS ( email TEXT ); CREATE TYPE

Re: [GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread Bruno Wolff III
On Wed, Aug 17, 2016 at 23:02:53 -0700, Silk Parrot wrote: Hi,     I am trying to model a social login application. The application can support multiple login providers. I am thinking of creating a custom type for each provider. e.g. CREATE TABLE user (     uuid UUID

Re: [GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread David G. Johnston
On Thu, Aug 18, 2016 at 2:02 AM, Silk Parrot wrote: > > However, the above create table query reports syntax error: > > ERROR: syntax error at or near "." > LINE 10: UNIQUE (google_user.email) > > Is there a way to create unique constraint on a field inside composite >

[GENERAL] Unique constraint on field inside composite type.

2016-08-22 Thread Silk Parrot
Hi,     I am trying to model a social login application. The application can support multiple login providers. I am thinking of creating a custom type for each provider. e.g. CREATE TYPE system.google_user AS (    email TEXT ); CREATE TYPE system.facebook_user AS (    id TEXT );    And