CURRENT/OLD keywords still broken
CURRENT/OLD keywords still broken
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
peter=# select 1 as current;old ----- 1 This is now the inverse of what it used to do, but it's still not what it *should* do. I see someone already tried to fix that (keywords.c 1.76 -> 1.77, TODO list), but he should try again. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Re: CURRENT/OLD keywords still broken
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> peter=# select 1 as current;
> old
> -----
> 1
>
> This is now the inverse of what it used to do, but it's still not what it
> *should* do. I see someone already tried to fix that (keywords.c 1.76 ->
> 1.77, TODO list), but he should try again.
That was me. The old code did old -> current, so I changed it to do
current -> old. How else can I fix this? Attached is the old patch.
-- 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, Pennsylvania 19026
Index: keywords.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -c -r1.76 -r1.77
*** keywords.c 2000/06/12 03:40:30 1.76
--- keywords.c 2000/06/12 19:40:41 1.77
***************
*** 9,17 **** * * IDENTIFICATION <<<<<<< keywords.c
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/12 03:40:30 momjian Exp $ =======
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/12 03:40:30 momjian Exp $ >>>>>>> 1.73 * *-------------------------------------------------------------------------
--- 9,17 ---- * * IDENTIFICATION <<<<<<< keywords.c
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/12 19:40:41 momjian Exp $ =======
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/12 19:40:41 momjian Exp $ >>>>>>> 1.73 * *-------------------------------------------------------------------------
***************
*** 77,82 ****
--- 77,84 ---- {"createdb", CREATEDB}, {"createuser", CREATEUSER}, {"cross", CROSS},
+ /* for portability with old rules bjm 2000-06-12 */
+ {"current", OLD}, {"current_date", CURRENT_DATE}, {"current_time", CURRENT_TIME}, {"current_timestamp", CURRENT_TIMESTAMP},
***************
*** 183,189 **** {"off", OFF}, {"offset", OFFSET}, {"oids", OIDS},
! {"old", CURRENT}, {"on", ON}, {"only", ONLY}, {"operator", OPERATOR},
--- 185,191 ---- {"off", OFF}, {"offset", OFFSET}, {"oids", OIDS},
! {"old", OLD}, {"on", ON}, {"only", ONLY}, {"operator", OPERATOR},
Re: CURRENT/OLD keywords still broken
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut writes: > peter=# select 1 as current; > old > ----- > 1 > This is now the inverse of what it used to do, but it's still not what it > *should* do. I see someone already tried to fix that (keywords.c 1.76 -> > 1.77, TODO list), but he should try again. We should rip out the whole current/old aliasing, IMHO. CURRENT has been unsupported for a version or two now, hasn't it? I had that on my personal TODO list, but I was going to leave it till after 7.1 because I had mistakenly thought that CURRENT was still a keyword in 7.0. But it wasn't, was it? Bruce, why did you put in that mapping? regards, tom lane
Re: CURRENT/OLD keywords still broken
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian writes:
> That was me. The old code did old -> current, so I changed it to do
> current -> old. How else can I fix this? Attached is the old patch.
But CURRENT was strictly an internal token name, not a string the user
could actually see. So there's no need to have
+ /* for portability with old rules bjm 2000-06-12 */
+ {"current", OLD},
The only way that there would be a compatibility problem would be if
ruleutils.c had been set up to print CURRENT, but it wasn't:
*** 1278,1284 **** quote_identifier(rte->relname)); else if (!strcmp(rte->ref->relname, "*NEW*")) appendStringInfo(buf, "new.");
! else if (!strcmp(rte->ref->relname, "*CURRENT*")) appendStringInfo(buf, "old."); else appendStringInfo(buf, "%s.",
--- 1278,1284 ---- quote_identifier(rte->relname)); else if (!strcmp(rte->ref->relname, "*NEW*")) appendStringInfo(buf, "new.");
! else if (!strcmp(rte->ref->relname, "*OLD*")) appendStringInfo(buf, "old."); else
NEW and OLD are what the user see, and have been for awhile. So there's
no compatibility issue here.
regards, tom lane
Re: CURRENT/OLD keywords still broken
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Bruce Momjian writes: > > peter=# select 1 as current; > > old > > ----- > > 1 > > > > This is now the inverse of what it used to do, but it's still not what it > > *should* do. I see someone already tried to fix that (keywords.c 1.76 -> > > 1.77, TODO list), but he should try again. > > That was me. The old code did old -> current, so I changed it to do > current -> old. How else can I fix this? Attached is the old patch. Maybe add another branch into the SpecialRuleRelation grammar rule with CURRENT instead of OLD. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Re: CURRENT/OLD keywords still broken
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
OK, compatibility mapping removed.
> Bruce Momjian writes:
> > That was me. The old code did old -> current, so I changed it to do
> > current -> old. How else can I fix this? Attached is the old patch.
>
> But CURRENT was strictly an internal token name, not a string the user
> could actually see. So there's no need to have
> + /* for portability with old rules bjm 2000-06-12 */
> + {"current", OLD},
>
> The only way that there would be a compatibility problem would be if
> ruleutils.c had been set up to print CURRENT, but it wasn't:
>
> *** 1278,1284 ****
> quote_identifier(rte->relname));
> else if (!strcmp(rte->ref->relname, "*NEW*"))
> appendStringInfo(buf, "new.");
> ! else if (!strcmp(rte->ref->relname, "*CURRENT*"))
> appendStringInfo(buf, "old.");
> else
> appendStringInfo(buf, "%s.",
> --- 1278,1284 ----
> quote_identifier(rte->relname));
> else if (!strcmp(rte->ref->relname, "*NEW*"))
> appendStringInfo(buf, "new.");
> ! else if (!strcmp(rte->ref->relname, "*OLD*"))
> appendStringInfo(buf, "old.");
> else
>
> NEW and OLD are what the user see, and have been for awhile. So there's
> no compatibility issue here.
>
> regards, tom lane
>
-- 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, Pennsylvania 19026