bug fix for select 'some Text'::char(16) (newest snapshot) - Mailing list pgsql-hackers

From Zeugswetter Andreas DBT
Subject bug fix for select 'some Text'::char(16) (newest snapshot)
Date
Msg-id 219F68D65015D011A8E000006F8590C6010A51B9@sdexcsrv1.sd.spardat.at
Whole thread Raw
Responses Re: [HACKERS] bug fix for select 'some Text'::char(16) (newest snapshot)  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
I noticed a bug in parse_expr.c line 104:

template1=> select 'Andreas'::char(16);
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
        This probably means the backend terminated abnormally before or
while processing the request.
template1=> \c template1
connecting to new database: template1
template1=> select 'Andreas'::varchar(16);
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
        This probably means the backend terminated abnormally before or
while processing the request.
template1=> \c template1
template1=> select 'this works'::char16;
?column?
--------
this works
(1 row)
snapshot 020298 on aix_gcc and on linux_elf same behavior

dbx sais:
(dbx) where
[stipped some lines]
palloc(0x0), line 69 in "palloc.c"
bpcharin(0x2007cb48, 0x12, 0x0), line 78 in "varchar.c"
fmgr_c(0x2ff20520, 0x2ff204f8, 0x2ff20530), line 107 in "fmgr.c"
fmgr(), line 285 in "fmgr.c"
stringTypeString(0x2008a108, 0x2007cb48, 0x0), line 146 in
"parse_type.c"
parser_typecast(0x20088ab0, 0x20088ae8, 0x0), line 434 in "parse_expr.c"
unnamed block $b768, line 104 in "parse_expr.c"
transformExpr(0x20088c88, 0x20088aa8, 0x1), line 104 in "parse_expr.c"
[stripped some lines]

Notice:     the atttypmod is 0 instead of -1 (or maybe it should be
16, but I would
    ignore the char(16) argument in the cast and use -1)

line should be:
*** parse_expr.c.ori    Mon Feb  2 09:00:20 1998
--- parse_expr.c        Mon Feb  2 14:20:14 1998
***************
*** 103,105 ****
                                if (con->typename != NULL)
!                                       result = parser_typecast(val,
con->typename, 0);
                                else
--- 103,105 ----
                                if (con->typename != NULL)
!                                       result = parser_typecast(val,
con->typename, -1);
                                else

seems to work fine !

Andreas

pgsql-hackers by date:

Previous
From: "Vadim B. Mikheev"
Date:
Subject: subquery syntax broken
Next
From: Andrew Martin
Date:
Subject: Re: [HACKERS] snapshot won't compile on irix6.2