Re: Unique constraint on field inside composite type.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Silk Parrot <silkparrot(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unique constraint on field inside composite type.
Date: 2016-08-22 18:40:41
Message-ID: CAKFQuwbthE-o_Gdk9vdR+m9N1C=D2E+H4i4HWdrSQtS12QsPfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 18, 2016 at 2:02 AM, Silk Parrot <silkparrot(at)gmail(dot)com> 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
> type?
>

​Not tested here but in most (all?) cases when attempting to de-reference a
component of a composite typed column you must place the column name within
parentheses.

(google_user).email

Otherwise the system is thinking that "google_user" is a schema and email
is a column.

David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2016-08-22 20:13:04 Re: Why insertion throughput can be reduced with an increase of batch size?
Previous Message Kevin Grittner 2016-08-22 18:07:03 Re: incorrect checksum detected on "global/pg_filenode.map" when VACUUM FULL is executed