On Fri, Sep 09, 2005 at 05:20:58PM +0200, Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2005-09-09 09:10:30 -0600:
> > On Fri, Sep 09, 2005 at 10:39:58AM -0400, Tom Lane wrote:
> > > I don't believe you need the function -- this should be enough:
> > >
> > > CREATE UNIQUE INDEX t1_b_uniq ON t1 ((
Richard Huxton writes:
> Tom Lane wrote:
>> 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)
Sorry, make that
CREATE UNIQUE INDEX t1_b_uniq ON t1 (((attr).foo));
# [EMAIL PROTECTED] / 2005-09-09 09:10:30 -0600:
> On Fri, Sep 09, 2005 at 10:39:58AM -0400, Tom Lane wrote:
> > I don't believe you need the function -- this should be enough:
> >
> > CREATE UNIQUE INDEX t1_b_uniq ON t1 ((attr.foo));
>
> I was expecting that to work too, but it doesn't:
>
> ERR
On Fri, Sep 09, 2005 at 10:39:58AM -0400, Tom Lane wrote:
> I don't believe you need the function -- this should be enough:
>
> CREATE UNIQUE INDEX t1_b_uniq ON t1 ((attr.foo));
I was expecting that to work too, but it doesn't:
ERROR: relation "attr" does not exist
--
Michael Fuhr
--
Tom Lane wrote:
Richard Huxton 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, a
Richard Huxton 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 al
Roman Neuhauser wrote:
This fails on 8.0.3 (syntax error at or near "." at character):
CREATE TYPE ct AS (
foo INTEGER,
bar INTEGER
);
CREATE TABLE t1 (
attr ct,
CONSTRAINT uq UNIQUE (attr.foo)
);
Should it be possible? From reading
http://www.postgresql.org/docs/current/static/rowtype
This fails on 8.0.3 (syntax error at or near "." at character):
CREATE TYPE ct AS (
foo INTEGER,
bar INTEGER
);
CREATE TABLE t1 (
attr ct,
CONSTRAINT uq UNIQUE (attr.foo)
);
Should it be possible? From reading
http://www.postgresql.org/docs/current/static/rowtypes.html it looks
like almo