Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: sferac(at)bo(dot)nettuno(dot)it, hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
Date: 1998-02-05 16:18:25
Message-ID: 34D9E651.338F6C0@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck wrote:

> Hi,
>
> >
> > > There's an error while inserting data into a column defined as VARCHAR without
> > > length in PostgreSQL 6.3.
> > > Take a look:
> > >
> > > postgres=> CREATE TABLE prova ( uno VARCHAR(10) );
> > > CREATE
> > > postgres=> INSERT INTO prova VALUES ( 'OK' );
> > > INSERT 153042 1
> > >
> > > postgres=> CREATE TABLE prova2 ( uno VARCHAR );
> > > CREATE
> > > postgres=> INSERT INTO prova2 VALUES ( 'NOT OK' );
> > > 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.
> >
> > Jose, please post problem reports to hackers, not to questions, on not-yet-released versions. I've moved
> > this to hackers.
> >
> > btw, I saw this too but in a different context and wasn't certain if it was a new problem:
> >
> > postgres=> select char_length('hi'::text);
> > length
> > ------
> > 2
> > (1 row)
> >
> > postgres=> select character_length('hi'::varchar);
> > 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.
> >
> > - Tom
>
> ARRRRG - then next problem with VARSIZE - damn thing.
>
> This time it's during the parser (gdb told me). varcharin()
> is called with a atttypmod of 0 causing a palloc() of 0
> bytes. How should a VARCHAR type whithout a specified length
> behave? Is this type 1 character or a variable size up to
> 4096?

It should allow any length (up to the implementation maximum of 4096). The usage is not defined for SQL92,
unlike the case for "char" with no explicit size which defaults to one.

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-02-05 16:45:17 Re: [QUESTIONS] MySQL benchmark page
Previous Message Jan Wieck 1998-02-05 16:16:01 Re: [HACKERS] Bug?