Lists: | pgsql-hackers |
---|
From: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | \c connects as another user instead I want in psql |
Date: | 2001-05-02 16:40:30 |
Message-ID: | Pine.LNX.4.21.0105021834010.24311-100000@pc10.radnoti-szeged.sulinet.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
This may be a reported bug. 7.1beta4.
I use user names mostly as numbers. E.g. 1050, 1060, 1092.
Sometimes I got strange result when I try to reconnect:
tir=> \c - 1022
You are now connected as new user 1022.
tir=> select user;
current_user
--------------
1022
(1 row)
(It's OK.)
tir=> \c - 1060
You are now connected as new user 1060.
tir=> select user;
current_user
--------------
1092
(1 row)
This is the problematic point. Is this a solved bug?
TIA, Zoltan
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-02 22:32:39 |
Message-ID: | 17288.988842759@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> tir=> \c - 1060
> You are now connected as new user 1060.
> tir=> select user;
> current_user
> --------------
> 1092
> (1 row)
Is it possible that 1060 and 1092 have the same usesysid in pg_shadow?
regards, tom lane
From: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 09:18:15 |
Message-ID: | Pine.LNX.4.21.0105031114120.442-100000@pc10.radnoti-szeged.sulinet.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 2 May 2001, Tom Lane wrote:
> Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> > tir=> \c - 1060
> > You are now connected as new user 1060.
> > tir=> select user;
> > current_user
> > --------------
> > 1092
> > (1 row)
>
> Is it possible that 1060 and 1092 have the same usesysid in pg_shadow?
Hmmm. That was the problem. Thanks! By the way, could you please define a
unique constraint on column 'usesysid' in future in PostgreSQL?
Zoltan
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 13:07:30 |
Message-ID: | 23617.988895250@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
>> Is it possible that 1060 and 1092 have the same usesysid in pg_shadow?
> Hmmm. That was the problem. Thanks! By the way, could you please define a
> unique constraint on column 'usesysid' in future in PostgreSQL?
Yup, there should be one (and one on usename, too). Not sure why it's
been overlooked so far.
regards, tom lane
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 14:02:09 |
Message-ID: | Pine.LNX.4.30.0105031600340.900-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan writes:
> By the way, could you please define a unique constraint on column
> 'usesysid' in future in PostgreSQL?
The usesysid column will be removed and the oid column will be used
instead. That one tends to be unique, but an index will still be added.
--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter
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: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 15:16:25 |
Message-ID: | 200105031516.f43FGPV26098@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> >> Is it possible that 1060 and 1092 have the same usesysid in pg_shadow?
>
> > Hmmm. That was the problem. Thanks! By the way, could you please define a
> > unique constraint on column 'usesysid' in future in PostgreSQL?
>
> Yup, there should be one (and one on usename, too). Not sure why it's
> been overlooked so far.
TODO item has:
* Add unique indexes to pg_shadow.usename and pg_shadow.usesysid
I overlooked it long ago because there is no cache lookup on that
column.
--
Bruce Momjian | http://candle.pha.pa.us
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
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 15:17:21 |
Message-ID: | 200105031517.f43FHLQ26152@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> Kovacs Zoltan writes:
>
> > By the way, could you please define a unique constraint on column
> > 'usesysid' in future in PostgreSQL?
>
> The usesysid column will be removed and the oid column will be used
> instead. That one tends to be unique, but an index will still be added.
Really? We are removing usesysid? Seems the admin will no longer be
able to choose the users id, right?
--
Bruce Momjian | http://candle.pha.pa.us
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
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-03 15:49:27 |
Message-ID: | Pine.LNX.4.30.0105031749030.900-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Bruce Momjian writes:
> Really? We are removing usesysid? Seems the admin will no longer be
> able to choose the users id, right?
Not that this was ever useful.
--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter
From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-07 14:42:41 |
Message-ID: | 200105071442.KAA02155@jupiter.jw.home |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut wrote:
> Bruce Momjian writes:
>
> > Really? We are removing usesysid? Seems the admin will no longer be
> > able to choose the users id, right?
>
> Not that this was ever useful.
Except for re-adding users.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Wieck <JanWieck(at)yahoo(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-07 15:11:42 |
Message-ID: | 21261.989248302@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
>>> Really? We are removing usesysid? Seems the admin will no longer be
>>> able to choose the users id, right?
>>
>> Not that this was ever useful.
> Except for re-adding users.
Yes. In theory, the correct answer to that is to add referential
integrity checks that prevent you from dropping a user that still
owns any objects. In practice, this is impractical because users
span a whole database installation. We have no reasonable way to
check whether the user owns objects in other databases that cannot
be seen from the DB where we are issuing the DROP USER command.
Therefore, for the foreseeable future it will be important to be
able to reverse a DROP USER command --- ie, recreate a user with
the same user identifier previously used.
After thinking about that for awhile, I am inclined to change my
previous position: we should not switch over to using the OIDs of
pg_shadow rows as user identifiers. usesysid should continue to
exist. Ditto for groups --- grosysid can't go away either.
I think the original motivation for wanting to eliminate these columns
was that we need usesysid and grosysid to be distinct (can't use the
same ID for both a user and a group). Using OIDs as IDs would fix
that, but it's overkill. Wouldn't it be sufficient to use an
installation-wide sequence object to assign new IDs for new users and
groups? We have no such animals at the present, but I see no reason
why we couldn't make one.
regards, tom lane
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: | Jan Wieck <JanWieck(at)yahoo(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-07 18:40:33 |
Message-ID: | 200105071840.f47IeXN19882@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> I think the original motivation for wanting to eliminate these columns
> was that we need usesysid and grosysid to be distinct (can't use the
> same ID for both a user and a group). Using OIDs as IDs would fix
> that, but it's overkill. Wouldn't it be sufficient to use an
> installation-wide sequence object to assign new IDs for new users and
> groups? We have no such animals at the present, but I see no reason
> why we couldn't make one.
Updated TODO to show both options:
* Add unique indexes to pg_shadow.usename and pg_shadow.usesysid or
switch to pg_shadow.oid as user id
--
Bruce Momjian | http://candle.pha.pa.us
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
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: | Jan Wieck <JanWieck(at)yahoo(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: \c connects as another user instead I want in psql |
Date: | 2001-05-07 19:53:25 |
Message-ID: | 200105071953.f47JrPH25668@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> After thinking about that for awhile, I am inclined to change my
> previous position: we should not switch over to using the OIDs of
> pg_shadow rows as user identifiers. usesysid should continue to
> exist. Ditto for groups --- grosysid can't go away either.
>
> I think the original motivation for wanting to eliminate these columns
> was that we need usesysid and grosysid to be distinct (can't use the
> same ID for both a user and a group). Using OIDs as IDs would fix
> that, but it's overkill. Wouldn't it be sufficient to use an
> installation-wide sequence object to assign new IDs for new users and
> groups? We have no such animals at the present, but I see no reason
> why we couldn't make one.
One thing on the TODO list is to allow people to soecify OID's on
INSERT. There is no reason we should disallow it, and it could come in
handy for fixing deleted rows.
--
Bruce Momjian | http://candle.pha.pa.us
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
From: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
---|---|
To: | Jan Wieck <JanWieck(at)yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | bug in PLPGSQL |
Date: | 2001-05-14 08:38:08 |
Message-ID: | Pine.LNX.4.21.0105141032120.941-100000@pc10.radnoti-szeged.sulinet.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
In 7.1.1 the following statement doesn't work (backend closes
immediately):
SELECT INTO var1, var2 col1, col2 FROM table WHERE conditions;
In 7.1 (final) this problem doesn't occur.
Workaround:
var1 := col1 FROM table WHERE conditions;
var2 := col2 FROM table WHERE conditions;
(Of course I'd better not rewrite my 200K code of PLGSQL... :-)
TIA, Zoltan
--
Kov\'acs, Zolt\'an
kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu
http://www.math.u-szeged.hu/~kovzol
ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
From: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | Jan Wieck <JanWieck(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: bug in PLPGSQL |
Date: | 2001-05-14 09:48:24 |
Message-ID: | 3AFFA9E8.3D574255@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan wrote:
>
> In 7.1.1 the following statement doesn't work (backend closes
> immediately):
>
> SELECT INTO var1, var2 col1, col2 FROM table WHERE conditions;
>
> In 7.1 (final) this problem doesn't occur.
>
It's a known bug.
If you in a hurry, please apply the latest change for
src/pl/plpgsql/src/pl_exec.c by Tom.
regards,
Hiroshi Inoue
From: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
---|---|
To: | Jan Wieck <JanWieck(at)yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: bug in PLPGSQL |
Date: | 2001-05-14 09:52:38 |
Message-ID: | Pine.LNX.4.21.0105141148540.1153-100000@pc10.radnoti-szeged.sulinet.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
There are SELECT INTO statements which work properly. Here is an example
which closes the backend:
CREATE FUNCTION plpgsql_call_handler ( ) RETURNS opaque AS '/usr/local/pgsql-7.1.1/lib/plpgsql.so' LANGUAGE 'C';
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL';
create table foo(x int4, y int4);
create function bugtest(int4) returns int4 as '
declare
_x int4;
_y int4;
begin
select into _x,_y
x, y from foo where x = $1 limit 1;
return x;
end;
' language 'plpgsql';
select bugtest(5);
If the WHERE clause doesn't contain any input parameters (i.e. $1), I
don't get into any trouble.
Zoltan
--
Kov\'acs, Zolt\'an
kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu
http://www.math.u-szeged.hu/~kovzol
ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | Jan Wieck <JanWieck(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: bug in PLPGSQL |
Date: | 2001-05-14 14:26:10 |
Message-ID: | 9062.989850370@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> In 7.1.1 the following statement doesn't work (backend closes
> immediately):
> SELECT INTO var1, var2 col1, col2 FROM table WHERE conditions;
Would you mind providing a complete test case, so that we don't waste
time guessing at context?
regards, tom lane
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | Jan Wieck <JanWieck(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: bug in PLPGSQL |
Date: | 2001-05-14 14:41:13 |
Message-ID: | 9170.989851273@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> If the WHERE clause doesn't contain any input parameters (i.e. $1), I
> don't get into any trouble.
Is this the known bug with failure if the SELECT returns zero rows?
regards, tom lane
From: | Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: bug in PLPGSQL |
Date: | 2001-05-14 16:13:07 |
Message-ID: | Pine.LNX.4.21.0105141810330.1610-100000@pc10.radnoti-szeged.sulinet.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, 14 May 2001, Tom Lane wrote:
> Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> writes:
> > If the WHERE clause doesn't contain any input parameters (i.e. $1), I
> > don't get into any trouble.
>
> Is this the known bug with failure if the SELECT returns zero rows?
Yes, it is. I haven't known this bug yet, however I read the mailing lists
first. I also tried your patch and it works now greatly. Thanks,
Zoltan