On Fri, Jan 13, 2006 at 05:40:25PM +0000, ngelo Marcos Rigo wrote:
> My table definition (i change the deafult to 'N') :
>
> CREATE TABLE pautaitem
> (
> cdpautaitem serial NOT NULL,
> arquivo varchar(255),
> item varchar(255),
> cdpauta varchar(255),
> cditem varchar(11) NOT NULL DEFAULT 'N',
> CONSTRAINT pauta_arquivos_pkey PRIMARY KEY
> (cdpautaitem)
> )
>
> My insert query:
>
> INSERT INTO PautaItem (
> CdPauta,
> Item,
> CdItem,
> Arquivo) VALUES (
> '"+this.sCdPauta',
> '"+this.sItem',
> '"+this.sCdItem',
> '"+this.sArqImagem')
What was the result and how does it differ from what you were
expecting? When I run the above statements I get
ERROR: value too long for type character varying(11)
I assume the '"+this.sCdItem' values aren't literal but are going
to be interpolated into the INSERT statement by your application.
If that's the case, what does the final INSERT statement look like?
I'd guess you're inserting an empty string instead of NULL into the
cditem column, in which case the default expression won't be used.
--
Michael Fuhr