dbTalk Databases Forums  

Re: [BUGS] Bug in PostrgeSQL 8.0beta

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] Bug in PostrgeSQL 8.0beta in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-01-2004 , 10:21 AM






"Alexander Zhiltsov" <ayz (AT) ems (DOT) ru> writes:
Quote:
Executing the following query return an error 'ERROR: unrecognized node ty=
pe: 656'.
SELECT pg_get_expr(i.indexprs, i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid =3D c.oid
WHERE c.relname =3D 'art'
I'm not convinced this is really a bug, because pg_index.indexprs is not
an expression (it's a list of expressions) and so it's not clear that
pg_get_expr should be expected to work on it. What result were you
expecting to get?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-01-2004 , 10:24 AM






On Fri, Oct 01, 2004 at 02:46:33PM +0600, Alexander Zhiltsov wrote:

Quote:
Executing the following query return an error 'ERROR: unrecognized node type: 656'.
SELECT pg_get_expr(i.indexprs, i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid = c.oid
WHERE c.relname = 'art'

Expression tree is
({FUNCEXPR :funcid 4061872 :funcresulttype 25 :funcretset false :funcformat 0 :args ({RELABELTYPE :arg {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 64 :varlevelsup 0 :varnoold 1 :varoattno 2} :resulttype 25 :resulttypmod -1 :relabelformat 1})})
pg_get_expr() in PostgreSQL 8.0.0beta3 doesn't like the parentheses
that surround the expression. This query works for me:

SELECT pg_get_expr(trim(BOTH '()' FROM i.indexprs), i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid = c.oid
WHERE c.relname = 'art';

pg_get_expr() in PostgreSQL 7.4.5 works both ways.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-07-2004 , 03:40 PM



"Alexander Zhiltsov" <ayz (AT) ems (DOT) ru> writes:
Quote:
"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us> wrote:
I'm not convinced this is really a bug, because pg_index.indexprs is not
an expression (it's a list of expressions) and so it's not clear that
pg_get_expr should be expected to work on it. What result were you
expecting to get?

Yes, probably it is not a bug, but only a difference in behavior of function
pg_get_expr in versions 7.4 and 8.0.
Server 7.4 returns readable representation of index expressions that are
combined by 'AND'.
Hmm, well that wasn't really the desired behavior either, since the index
expressions certainly aren't combined as though by AND.

I've fixed it so that 8.0 will return the expressions comma-separated,
which seems a reasonably sane behavior.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #4  
Old   
Alexander Zhiltsov
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-10-2004 , 01:47 PM



Quote:
pg_get_expr() in PostgreSQL 8.0.0beta3 doesn't like the parentheses
that surround the expression. This query works for me:

SELECT pg_get_expr(trim(BOTH '()' FROM i.indexprs), i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid = c.oid
WHERE c.relname = 'art';

pg_get_expr() in PostgreSQL 7.4.5 works both ways.
Unfortunately 'trim(BOTH '()' FROM i.indexprs)' doesn't help for indices
that have more than one expression.

For example:
CREATE INDEX art_art_name_idx
ON public.art
USING btree
(my_lower(art_name::text), my_lower(art_firm_name::text));

Expression tree is
({FUNCEXPR :funcid 4061872 :funcresulttype 25 :funcretset false :funcformat
0 :args ({RELABELTYPE :arg {VAR :varno 1 :varattno 2 :vartype 1043
:vartypmod 64 :varlevelsup 0 :varnoold 1 :varoattno 2} :resulttype 25
:resulttypmod -1 :relabelformat 1})} {FUNCEXPR :funcid 4061872
:funcresulttype 25 :funcretset false :funcformat 0 :args ({RELABELTYPE :arg
{VAR :varno 1 :varattno 7 :vartype 1043 :vartypmod 39 :varlevelsup 0
:varnoold 1 :varoattno 7} :resulttype 25 :resulttypmod -1 :relabelformat
1})})

In this case pg_get_expr(trim(BOTH '()' FROM i.indexprs), i.indrelid)
returns only the first expression.
Server 7.4 returns the both that are combined by 'AND'.

Isn't it planned to implement the same behavior of the function in 8.0?

Alexander


----- Original Message -----
From: "Michael Fuhr" <mike (AT) fuhr (DOT) org>
To: "Alexander Zhiltsov" <ayz (AT) ems (DOT) ru>
Cc: <pgsql-bugs (AT) postgresql (DOT) org>
Sent: Friday, October 01, 2004 9:23 PM
Subject: Re: [BUGS] Bug in PostrgeSQL 8.0beta


Quote:
On Fri, Oct 01, 2004 at 02:46:33PM +0600, Alexander Zhiltsov wrote:

Executing the following query return an error 'ERROR: unrecognized node
type: 656'.
SELECT pg_get_expr(i.indexprs, i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid = c.oid
WHERE c.relname = 'art'

Expression tree is
({FUNCEXPR :funcid 4061872 :funcresulttype 25 :funcretset false
:funcformat 0 :args ({RELABELTYPE :arg {VAR :varno 1 :varattno 2 :vartype
1043 :vartypmod 64 :varlevelsup 0 :varnoold 1 :varoattno 2} :resulttype 25
:resulttypmod -1 :relabelformat 1})})
Quote:
pg_get_expr() in PostgreSQL 8.0.0beta3 doesn't like the parentheses
that surround the expression. This query works for me:

SELECT pg_get_expr(trim(BOTH '()' FROM i.indexprs), i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid = c.oid
WHERE c.relname = 'art';

pg_get_expr() in PostgreSQL 7.4.5 works both ways.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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


Reply With Quote
  #5  
Old   
Alexander Zhiltsov
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-10-2004 , 01:47 PM



Quote:
"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us> wrote:

I've fixed it so that 8.0 will return the expressions comma-separated,
which seems a reasonably sane behavior.
Thank you.


Alexander

----- Original Message -----
From: "Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us>
To: "Alexander Zhiltsov" <ayz (AT) ems (DOT) ru>
Cc: <pgsql-bugs (AT) postgresql (DOT) org>
Sent: Friday, October 08, 2004 2:39 AM
Subject: Re: [BUGS] Bug in PostrgeSQL 8.0beta


Quote:
"Alexander Zhiltsov" <ayz (AT) ems (DOT) ru> writes:
"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us> wrote:
I'm not convinced this is really a bug, because pg_index.indexprs is
not
an expression (it's a list of expressions) and so it's not clear that
pg_get_expr should be expected to work on it. What result were you
expecting to get?

Yes, probably it is not a bug, but only a difference in behavior of
function
pg_get_expr in versions 7.4 and 8.0.
Server 7.4 returns readable representation of index expressions that are
combined by 'AND'.

Hmm, well that wasn't really the desired behavior either, since the index
expressions certainly aren't combined as though by AND.

I've fixed it so that 8.0 will return the expressions comma-separated,
which seems a reasonably sane behavior.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
  #6  
Old   
Alexander Zhiltsov
 
Posts: n/a

Default Re: [BUGS] Bug in PostrgeSQL 8.0beta - 10-10-2004 , 01:49 PM



Thank you for the response.

"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us> wrote:

Quote:
I'm not convinced this is really a bug, because pg_index.indexprs is not
an expression (it's a list of expressions) and so it's not clear that
pg_get_expr should be expected to work on it. What result were you
expecting to get?
Yes, probably it is not a bug, but only a difference in behavior of function
pg_get_expr in versions 7.4 and 8.0.
Server 7.4 returns readable representation of index expressions that are
combined by 'AND'.

Isn't it planned to implement the same behavior of the function in 8.0?

Alexander


----- Original Message -----
From: "Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us>
To: "Alexander Zhiltsov" <ayz (AT) ems (DOT) ru>
Cc: <pgsql-bugs (AT) postgresql (DOT) org>
Sent: Friday, October 01, 2004 9:20 PM
Subject: Re: [BUGS] Bug in PostrgeSQL 8.0beta


Quote:
"Alexander Zhiltsov" <ayz (AT) ems (DOT) ru> writes:
Executing the following query return an error 'ERROR: unrecognized node
ty=
pe: 656'.
SELECT pg_get_expr(i.indexprs, i.indrelid) AS expr
FROM pg_index i
INNER JOIN pg_class c ON i.indrelid =3D c.oid
WHERE c.relname =3D 'art'

I'm not convinced this is really a bug, because pg_index.indexprs is not
an expression (it's a list of expressions) and so it's not clear that
pg_get_expr should be expected to work on it. What result were you
expecting to get?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.