Unique constraint on field inside composite type.

Поиск
Список
Период
Сортировка
От Silk Parrot
Тема Unique constraint on field inside composite type.
Дата
Msg-id etPan.57b54f92.50d1bedf.fb4d@gmail.com
обсуждение исходный текст
Ответы Re: Unique constraint on field inside composite type.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Unique constraint on field inside composite type.  (Bruno Wolff III <bruno@wolff.to>)
Re: Unique constraint on field inside composite type.  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
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 having user table like:

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)
);

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 type?

-- 
Regards
Ryan

В списке pgsql-general по дате отправления:

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: incorrect checksum detected on "global/pg_filenode.map" when VACUUM FULL is executed
Следующее
От: gilad905
Дата:
Сообщение: Re: Easiest way to compare the results of two queries row by row and column by column