Thread: CURRENT/OLD keywords still broken

CURRENT/OLD keywords still broken

From
Peter Eisentraut
Date:
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

From
Bruce Momjian
Date:
> 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,
Pennsylvania19026 
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

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> 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

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> 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

From
Peter Eisentraut
Date:
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

From
Bruce Momjian
Date:
OK, compatibility mapping removed.

> Bruce Momjian <pgman@candle.pha.pa.us> 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,
Pennsylvania19026