Thread: Bug in ALTER LANGUAGE ... RENAME TO ...;

Bug in ALTER LANGUAGE ... RENAME TO ...;

From
"Sergey N. Yatskevich"
Date:
RenameLanguage procedure in src/backend/commands/proclang.c open
and update pg_catalog.pg_shadow table instead pg_catalog.pg_language.

--
Sergey N. Yatskevich <syatskevich@2100.gosniias.ru>

Attachment

Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

From
Bruce Momjian
Date:
Oh, good catch.  We will fix that.  Thanks.

Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------


Sergey N. Yatskevich wrote:
> RenameLanguage procedure in src/backend/commands/proclang.c open
> and update pg_catalog.pg_shadow table instead pg_catalog.pg_language.
>
> --
> Sergey N. Yatskevich <syatskevich@2100.gosniias.ru>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

From
Tom Lane
Date:
"Sergey N. Yatskevich" <syatskevich@2100.gosniias.ru> writes:
> RenameLanguage procedure in src/backend/commands/proclang.c open
> and update pg_catalog.pg_shadow table instead pg_catalog.pg_language.

Wow.  Apparently this has been broken since it was written, and
nobody ever tested it.  Thanks!

            regards, tom lane

Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

From
Tom Lane
Date:
> "Sergey N. Yatskevich" <syatskevich@2100.gosniias.ru> writes:
>> RenameLanguage procedure in src/backend/commands/proclang.c open
>> and update pg_catalog.pg_shadow table instead pg_catalog.pg_language.

> Wow.  Apparently this has been broken since it was written, and
> nobody ever tested it.  Thanks!

BTW, is there a security issue here?  In my testing all I got was
harmless "tuple concurrently updated" failures --- but it seems like
this bug ought to result in either a core dump or storing a bogus row
into pg_shadow.  Neither of which sound appealing.

            regards, tom lane

Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

From
Bruce Momjian
Date:
Patch applied by Tom.  Thanks.

---------------------------------------------------------------------------


Sergey N. Yatskevich wrote:
> RenameLanguage procedure in src/backend/commands/proclang.c open
> and update pg_catalog.pg_shadow table instead pg_catalog.pg_language.
>
> --
> Sergey N. Yatskevich <syatskevich@2100.gosniias.ru>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

From
Tom Lane
Date:
"Sergey N. Yatskevich" <syatskevich@2100.gosniias.ru> writes:
> ÷ ðÎÄ, 14/02/2005 × 01:52 -0500, Tom Lane ÐÉÛÅÔ:
>> BTW, is there a security issue here?

> I think this is not good but not so bad because:
> 1) ALTER LANGUAGE can be used only users with superuser privilegies

Right --- that check is made before we do anything that could go wrong.
So, no security hole, because if you are superuser you already have the
keys to the kingdom anyway ...

> We catch this error only because we try to do formal testing of all
> PostgreSQL features listed in documentation.

Cool.  What progress are you making?

            regards, tom lane