> 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


Thu, 05 Feb 1998 15:18:27 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [QUESTIONS] impossible insert data into VARCHAR
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?


Until later, Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #



Thu, 5 Feb 1998 17:06:20 +0100 (MET)
jwieck@debis.com (Jan Wieck)
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
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


Thu, 05 Feb 1998 16:18:25 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
>
> Jan Wieck wrote:
>
> > > [... quoting level exceeded ...]
> >
> >     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.
>

    Could be hacked into varcharin(). If the test on atttypmod is
    changed from "!= -1" into "> 0" it  works  that  way.   Don't
    have  the  time  right now to run a regression test, but some
    typed queries with

    select into t values ...

    and

    select into t select ...

    worked O.K.


Until later, Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #



Thu, 5 Feb 1998 17:54:14 +0100 (MET)
jwieck@debis.com (Jan Wieck)
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
Do we need to disallow varchar() and char() without a length?

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


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

Thu, 5 Feb 1998 12:00:48 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
On Thu, 5 Feb 1998, Thomas G. Lockhart wrote:

> > 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.
Ok, sorry.
> 
> 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)
> 

I've another problem about connection
when I try to connect to PostgreSQL using:
           psql postgres -h server
I have this error:

Connection to database 'postgres' failed.
User authentication failed


I'd ran postmaster with -i as:

postmaster -i -o -F -B 512 -S > server.log 2>&1

Any idea?
                      Thanks, Jose'


Thu, 5 Feb 1998 17:15:55 +0000 (GMT)
sferac@bo.nettuno.it
connection error
I am applying such a fix right now.

> 
>     Could be hacked into varcharin(). If the test on atttypmod is
>     changed from "!= -1" into "> 0" it  works  that  way.   Don't
>     have  the  time  right now to run a regression test, but some
>     typed queries with
> 
>     select into t values ...
> 
>     and
> 
>     select into t select ...
> 
>     worked O.K.
> 
> 
> Until later, Jan
> 
> --
> 
> #======================================================================#
> # It's easier to get forgiveness for being wrong than for being right. #
> # Let's break this rule - forgive me.                                  #
> #======================================== jwieck@debis.com (Jan Wieck) #
> 
> 
> 
> 


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

Thu, 5 Feb 1998 12:18:28 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR
> Do we need to disallow varchar() and char() without a length?

The question might be moot since Jan's suggestion may fix the behavior. But, just for completeness...

char, char(), and varchar() are SQL92 character types. varchar - with no arguments - is not, and seems as
though it is functionally equivalent to "text". Could do without it if necessary, but it is a nice extension.

                                               - Tom


Fri, 06 Feb 1998 02:28:07 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] Re: [QUESTIONS] impossible insert data into VARCHAR