Skip site navigation (1) Skip section navigation (2)

No subselects in constraint (bug?)

From: "Alexey V(dot) Neyman" <avn(at)any(dot)ru>
To: <pgsql-sql(at)postgresql(dot)org>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: No subselects in constraint (bug?)
Date: 2001-07-13 10:16:23
Message-ID: 20010713135728.U2566-100000@srv2.any (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-sql
Hello there!

[Please Cc: me in followups.]

I tried the following:

CREATE TABLE a (
  int4 id
);
CREATE TABLE b (
  int4 id
  CHECK (id = ANY(SELECT a.id FROM a))
);

Tables are created ok, checking with '\d table' confirms it. But when I
try to insert into table b, e.g.:
INSERT INTO b (id)
  VALUES (0);
I get:
ERROR:  ExecEvalExpr: unknown expression type 108
Of course, the tuple is not inserted.

As quick dig of code showed, type 108 is T_SubLink which is created for
ANY() subselect, and ExecEvalExpr() function does not handle this type of
node. Is it intentional or a bug?

I use 7.0.3, but 7.1.2 code looks pretty the same in ExecEvalExpr(). The
platform is FreeBSD 4.3-R.

TIA for responses,
Alexey.

-- 
-------------------------------------------------+---------------------------
             Yes.  We have good news!            | Regards, Alexey V. Neyman
      Well, that is to say, we have no news.     |     mailto: avn(at)any(dot)ru
----------------------------------( Pkunk, SC2 )-+---------------------------


Responses

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-07-13 16:17:44
Subject: your web site register is broken, cannot download Win32 distribution needed
Previous:From: Bruce MomjianDate: 2001-07-12 22:42:12
Subject: Re: JDBC - DatabaseMetaData.getTables() null pointer exception

pgsql-sql by date

Next:From: James OrrDate: 2001-07-13 13:41:16
Subject: Re: Referencing a view?
Previous:From: Luis SousaDate: 2001-07-13 09:20:14
Subject: Executing RECORD's inside a FUNCTION

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group