Bug(s) or not?
Bug(s) or not?
От:
Teodor Sigaev <teodor@sigaev.ru>
Дата:
Hi!
Simple test suite for current CVS:
%initdb ...
%createdb q
%psql q
q=# select * from pg_class limit 1;
SELECT
q=# select * from pg_class limit 2;
server sent data ("D" message) without prior row description ("T" message)
SELECT
q=# select * from pg_class limit 3;
server sent data ("D" message) without prior row description ("T" message)
server sent data ("D" message) without prior row description ("T" message)
SELECT
Why can I select from pg_class? Other system tables are working properly...
And one more:
q=# create table q(i int);
CREATE TABLE
q=# insert into q values (1);
INSERT 17450 1
q=# insert into q values (2);
INSERT 17451 1
q=# select count(*) from q; count
------- 2
(1 row)
q=# select count(*) from q limit 1; count
------- 2
(1 row)
q=# select count(*) from q limit 1 offset 1; count
-------
(0 rows)
q=# select count(*) from q offset 1; count
-------
(0 rows)
q=# select count(*) from q offset 0; count
------- 2
(1 row)
I understand that it isn't correct query, but why pgsql do something strange
instead of say 'error'?
--
Teodor Sigaev E-mail: teodor@sigaev.ru
Re: Bug(s) or not?
От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Mon, May 26, 2003 at 14:17:52 +0400, Teodor Sigaev wrote: > > q=# select count(*) from q; > count > ------- > 2 > (1 row) > > q=# select count(*) from q limit 1; > count > ------- > 2 > (1 row) > > q=# select count(*) from q limit 1 offset 1; > count > ------- > (0 rows) > > q=# select count(*) from q offset 1; > count > ------- > (0 rows) > > q=# select count(*) from q offset 0; > count > ------- > 2 > (1 row) > > I understand that it isn't correct query, but why pgsql do something > strange instead of say 'error'? The above queries appear to be correct. The count returns a single row with the number of rows in the table. If you skip over that row using offset, you aren't going to get any rows.
Re: Bug(s) or not?
От:
Alvaro Herrera Munoz <alvherre@dcc.uchile.cl>
Дата:
On Mon, May 26, 2003 at 02:17:52PM +0400, Teodor Sigaev wrote:
> q=# select * from pg_class limit 3;
> server sent data ("D" message) without prior row description ("T" message)
> server sent data ("D" message) without prior row description ("T" message)
> SELECT
>
> Why can I select from pg_class? Other system tables are working properly...
Doh... I've been seen the same behavior, but thought it was some bug in
my local copy. In fact I'm having a hard time finding a bug with
unreleased locks with code that seems functionally identical to CVS head
and I'm starting to think that it's not really a bug with my
modifications.
--
Alvaro Herrera ()
Major Fambrough: You wish to see the frontier?
John Dunbar: Yes sir, before it's gone.
Re: Bug(s) or not?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Teodor Sigaev writes: > Why can I select from pg_class? Other system tables are working properly... That's darn bizarre. I see it too --- will look into it. > And one more: That all looks like correct behavior to me. LIMIT/OFFSET are with respect to the final query result, ie the single aggregate row. regards, tom lane
Re: Bug(s) or not?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
> Teodor Sigaev writes: >> Why can I select from pg_class? Other system tables are working properly... > That's darn bizarre. I see it too --- will look into it. Found it --- fix committed. Looks like libpq still needs some more work for error recovery, too --- it was losing the original error message about "unexpected field count in D message". regards, tom lane