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

Started by Sergey N. Yatskevichabout 21 years ago6 messagesbugs
Jump to latest
#1Sergey N. Yatskevich
syatskevich@2100.gosniias.ru

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>

Attachments:

postgresql-renamelg-fix.patchtext/x-patch; charset=KOI8-R; name=postgresql-renamelg-fix.patchDownload+1-1
#2Bruce Momjian
bruce@momjian.us
In reply to: Sergey N. Yatskevich (#1)
Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

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
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sergey N. Yatskevich (#1)
Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

"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

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#3)
Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

"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

#5Bruce Momjian
bruce@momjian.us
In reply to: Sergey N. Yatskevich (#1)
Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

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
#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sergey N. Yatskevich (#1)
Re: Bug in ALTER LANGUAGE ... RENAME TO ...;

"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