Re: constraints on composite types

From: Richard Huxton <dev(at)archonet(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: constraints on composite types
Date: 2005-09-09 15:00:54
Message-ID: 4321A3A6.5090708@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Richard Huxton <dev(at)archonet(dot)com> writes:
>
>>You might get somewhere with:
>
>
>>CREATE OR REPLACE FUNCTION testfunc(ct) RETURNS int AS
>>'SELECT $1.foo;'
>>LANGUAGE SQL IMMUTABLE;
>
>
>>CREATE UNIQUE INDEX t1_b_uniq ON t1 (testfunc(b));
>
>
> The point is that "attr.foo" is an expression, not a column name, and
> the SQL spec allows UNIQUE and PRIMARY KEY only on bare column names.
> I don't believe you need the function -- this should be enough:
>
> CREATE UNIQUE INDEX t1_b_uniq ON t1 ((attr.foo));

I got: Relation "attr" does not exist (on 8.1 beta)

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-09-09 15:10:30 Re: constraints on composite types
Previous Message Tom Lane 2005-09-09 14:53:23 Re: FW: Configuring Postgres to use unix sockets