Thread: Bug? Insert into new Datatype 7.0.x

Bug? Insert into new Datatype 7.0.x

From
"Michael Miyabara-McCaskey"
Date:
Hello all,

I have been experiencing a strange problem.

I did a import into "table1", and for the sake of not having complaints, all
fields are set to "text".  I then created a "table2" again with all types
set to text, and inserted a distinct set of the records from table1 into
table2.  No problems.

However, when I created "table3" which I used the correct data types (oid,
float4, float4), and selected the 3 specific rows from table2, and inserted
them into table3... The query ran for a little while, and then the backend
crashes...

I fumbled around for a while, but finally recreated table3 as (oid, text,
text), and it worked fine... My question what caused the backend to crash?

The data I was inserting into table3, was the actual oid from table2, column
2 and column 3 were number values of the form "x.xxx", or a null value.

Any thoughts?

-Michael Miyabara-McCaskey


Re: Bug? Insert into new Datatype 7.0.x

From
Tom Lane
Date:
"Michael Miyabara-McCaskey" <mykarz@miyabara.com> writes:
> I fumbled around for a while, but finally recreated table3 as (oid, text,
> text), and it worked fine... My question what caused the backend to crash?

> The data I was inserting into table3, was the actual oid from table2, column
> 2 and column 3 were number values of the form "x.xxx", or a null value.

It looks like the text-to-float4 converter function is not NULL-safe in
7.0.*.  Sorry about that :-(.

7.1 fixes a boatload of problems of that ilk.  In the meantime you could
kluge up something with a CASE expression that tests for null before
trying to cast to float4, or you could fix text_float4 to check for a
null input.

            regards, tom lane