Re: (PM) Re: [HACKERS] Ways to crash the backend

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: bus(at)fgan(dot)de (Michael Bussmann)
Cc: hackers(at)postgreSQL(dot)org (PostgreSQL-development), vadim(at)sable(dot)krasnoyarsk(dot)su (Vadim B(dot) Mikheev)
Subject: Re: (PM) Re: [HACKERS] Ways to crash the backend
Date: 1998-03-29 04:53:56
Message-ID: 199803290453.XAA27299@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Bruce,
>
> On 1998-03-28 10:15:48 -0500, Bruce Momjian wrote:
> > > SELECT DISTINCT * from x2 UNION SELECT * FROM x2;
> >
> > Sorry to disappoint you, but this is fixed in the 6.3.1 patch.
>
> No disappointment at all, but I upgraded from 6.3 to 6.3.1. Well, at least
> I think I did. Do you know of a way to get the current version of the
> program?

Now I am diappointed. You found a bug in my UNION code, and I am not
sure how to fix it.

> ~/data/PG_VERSION contains 6.3, so you may be right, but the HISTORY file
> states that one of the changes from 6.3 to 6.3.1 includes the possibility
> to use 'password' as a column identifier.

If history says 6.3.1 at the top, it is 6.3.1.

>
> Here's the output from my test system:
> # bus(at)goliath [1019] =>psql -c 'create table x (password int)'
> # CREATE
> # bus(at)goliath [1020] =>psql -c 'select distinct * from pg_user union select *
> # from pg_user'
> # PQexec() -- Request was sent to backend, but backend closed the ...

Yes, this crashes things. I have added to the TODO list:

* DISTINCT not on last query fails on UNION but not UNION ALL

UNION does an automatic distinct between the two queries

test=> insert into test1 values (1);
INSERT 18706 1
test=> insert into test1 values (1);
INSERT 18707 1
test=> insert into test1 values (1);
INSERT 18708 1
test=> insert into test2 values (2);
INSERT 18709 1
test=> insert into test2 values (2);
INSERT 18710 1
test=> select * from test1 union select * from test2;
x
-
1
2
(2 rows)

If you use UNION ALL, you don't get distinct, and the query you gave me
would work.

Not sure how to fix it. Could just disable the DISTINCT's when using
UNION and not UNION ALL, because it is redundant. Perhaps Vadim has a
comment on this.

t
>
> On another system that uses 6.3, 'password' isn't a valid id.
> # bus(at)tardis [1017] =>psql -c 'create table x (password int)'
> # ERROR: parser: parse error at or near "password"
>
> I hope I'm not upsetting you (or any of the developers) with my 'here's
> another silly command that crashes the backend'-reports.

Glad you are finding it. Glad I have a workaround for now. We will
keep it on the TODO list until it is fixed.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

Browse pgsql-hackers by date

  From Date Subject
Next Message Maurice Gittens 1998-03-29 12:33:21 found another overrun
Previous Message David Gould 1998-03-29 02:12:42 Re: [HACKERS] Modules