| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> | 
| Cc: | PgHacker <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: [Bug] SELECT INSTEAD with sub-query | 
| Date: | 2012-10-23 02:07:04 | 
| Message-ID: | 29751.1350958024@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> writes:
> postgres=# CREATE TABLE t1 (x int, y text);
> CREATE TABLE
> postgres=# CREATE RULE "_RETURN" AS ON SELECT TO t1 DO INSTEAD SELECT
> 1 AS x, 'aaa'::text AS y;
> CREATE RULE
> postgres=# SELECT * FROM t1;
>  x |  y
> ---+-----
>  1 | aaa
> (1 row)
> postgres=# SELECT tableoid, * FROM t1;
> TRAP: FailedAssertion("!(attno >= rel->min_attr && attno <=
> rel->max_attr)", File: "initsplan.c", Line: 180)
Huh.  I'm amazed nobody noticed this before.  It's really a bug in the
"convert table to view" logic: a view has no system columns so we ought
to remove the pg_attribute entries for the system columns, but we don't.
Given that we can't retroactively fix the pg_attribute rows for existing
views, I guess that we'll also have to put in a defense in the parser to
not believe that views have any system columns, even if pg_attribute
claims they do.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Farina | 2012-10-23 06:49:52 | Re: Successor of MD5 authentication, let's use SCRAM | 
| Previous Message | Greg Stark | 2012-10-22 23:31:54 | Re: [RFC] CREATE QUEUE (log-only table) for londiste/pgQ ccompatibility |