Thread: row value constructor bug?

row value constructor bug?

From
Tatsuo Ishii
Date:
In my understanding below row value constructors(I hope this term is
correct) exaples should return true, but PostgreSQL does not.

test=# select (1,0) > (0,0);?column? 
----------f
(1 row)

test=# select (0,1) > (0,0);?column? 
----------f
(1 row)

In my understanding, (a,b) > (c,d) is equal to:

 a > c or (a = c and b > d)
--
Tatsuo Ishii


Re: row value constructor bug?

From
Tom Lane
Date:
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> In my understanding below row value constructors(I hope this term is
> correct) exaples should return true, but PostgreSQL does not.

By my reading, a "row value constructor" is one of the things in
parentheses, while the whole clause is a "comparison predicate"
(per section 8.2 of SQL92).  But I agree that we don't seem to
have implemented the semantics correctly.  The code currently
responsible for this is makeRowExpr() in gram.y ... I tend to
agree with the comment on it that says that the functionality
should be pushed deeper ...
        regards, tom lane


Re: row value constructor bug?

From
Bruce Momjian
Date:
> Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> > In my understanding below row value constructors(I hope this term is
> > correct) exaples should return true, but PostgreSQL does not.
> 
> By my reading, a "row value constructor" is one of the things in
> parentheses, while the whole clause is a "comparison predicate"
> (per section 8.2 of SQL92).  But I agree that we don't seem to
> have implemented the semantics correctly.  The code currently
> responsible for this is makeRowExpr() in gram.y ... I tend to
> agree with the comment on it that says that the functionality
> should be pushed deeper ...

TODO item here?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026