Re: 7.0b3 pl/pgsql, ERROR: CURRENT used in non-rule query

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>, pghackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 7.0b3 pl/pgsql, ERROR: CURRENT used in non-rule query
Date: 2000-06-12 20:04:00
Message-ID: 200006122004.QAA01372@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Ed Loehr <eloehr(at)austin(dot)rr(dot)com> writes:
> >> 20000407.15:56:50.404 [8388] query: INSERT INTO time_report ( person_id,
> >> ... ) SELECT old.person_id, ... newAct.activity_id, ... FROM time_report
> >> old, activity oldAct, activity newAct WHERE oldAct.contract_id = $1 AND
> >> newAct.contract_id = $2 AND newAct.ref_number = oldAct.ref_number
> >> 20000407.15:56:50.404 [8388] ERROR: CURRENT used in non-rule query
>
> > I see my error: "old" is reserved for triggered functions...the error
> > message about "CURRENT" is a bit misleading, even so.
>
> Oh ... that's a hoot. The code thinks that the keyword is CURRENT.
> Someone apparently changed their minds at some point about the spelling
> of the keyword, and implemented the change by modifying the entry in
> keywords.c and nowhere else!
>
> {"of", OF},
> {"offset", OFFSET},
> {"oids", OIDS},
> {"old", CURRENT}, <====================== blech
> {"on", ON},
> {"only", ONLY},
>
> This leads to such interesting misbehaviors as
>
> regression=# select 'old' as old, 'older' as older;
> current | older
> ---------+-------
> old | older
> (1 row)
>
> (what was that column label again?)
>
> This isn't a showstopper kind of bug, but it probably oughta be fixed.

OK, I have made the required internal changes. However, to enable older
rules to be loaded, I had to map CURRENT to OLD, so we still have this
weird behavior, it is just now on CURRENT instead of OLD. We can remove
that hack in a few releases. Comment has been added to keyword.c just
above the entry.

The error message will also print correctly now.

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-06-12 20:04:53 Re: setproctitle
Previous Message Bruce Momjian 2000-06-12 19:48:56 Re: full text indexing & search