bug fix for select 'some Text'::char(16) (newest snapshot)

Started by Zeugswetter Andreas DBTalmost 28 years ago2 messages
#1Zeugswetter Andreas DBT
Andreas.Zeugswetter@telecom.at

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

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Zeugswetter Andreas DBT (#1)
Re: [HACKERS] bug fix for select 'some Text'::char(16) (newest snapshot)

Yes, I am inclined to agree with you. I will apply the patch.

---------------------------------------------------------------------------

*** 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

--
Bruce Momjian
maillist@candle.pha.pa.us