Inserting an empty string inserts a space
Posted in 1997
I'm having difficulties inserting an empty string into a table in
Informix Online Worgroup Server 7.12 running on Sun Solaris 2.5.1. I am
using this SQL statement:
UPDATE product_info SET prod_id = 1, prod_type_info_id = 1,short_description = 'Test', url = '', sort_order = 1 WHERE
prod_info_id=1;
The field "url" should be set to an empty string, but every time this
statement is executed, the "url" field has a single space in it: ' '. I
do not have anything special set on this field. It accepts nulls and
does not default to anything. Here is the table definition:
create table "informix".product_info
(
prod_info_id serial not null constraint "informix".n120_59,
prod_id integer,
prod_type_info_id integer,
description text,
short_description varchar(50),
url varchar(254),
sort_order integer,
primary key (prod_info_id) constraint "informix"._106_prom1
);
alter table "informix".product_info add constraint (foreign key
(prod_id)
references "informix".products constraint
"informix".fk_pi_prod_id);
alter table "informix".product_info add constraint (foreign key
(prod_type_info_id)
references "informix".product_type_info constraint
"informix".fk_pi_pti_id);
What would be causing this to happen? I don't think this is just a
problem with this table. I think it is happening in other inserts and
updates to different tables and fields as well.
Thanks for the help,
Tauren