Re: constraints on composite types

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: constraints on composite types
Дата
Msg-id 4321A3A6.5090708@archonet.com
обсуждение исходный текст
Ответ на Re: constraints on composite types  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: constraints on composite types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> Richard Huxton <dev@archonet.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

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: FW: Configuring Postgres to use unix sockets
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: constraints on composite types