Thread

  1. inability to restore infinity values via psql or pg_restore

    Thomas F.O'Connell <tfo@monsterlabs.com> — 2001-01-23T20:42:58Z

    discussion:
    
    this bug is a problem because it suggests that daily dumps of the database
    cannot be restored using psql -f or pg_restore (regardless of dump format)
    if there are any tables that contain infinite values.
    
    ---------------------------------------------------------------------------
    
    here is the exact sequence of steps required to produce my error:
    
    postgres]$ createdb foo
    postgres]$ psql foo
    foo=# create table foo ( foo interval );
    foo=# insert into foo( foo ) values( timestamp 'infinity' - timestamp '-infinity' );
    foo=# \q
    postgres]$ pg_dump -t foo foo >foo.sql
    postgres]$ psql -c 'drop table foo' foo
    postgres]$ psql -f foo.sql foo
    
    ---------------------------------------------------------------------------
    
    output i got:
    
    CREATE
    UPDATE 1
    psql:foo.sql:21: ERROR:  copy: line 1, Bad interval external representation '-2147483648 --2147483648:-2147483648:  inf'
    psql:foo.sql:21: PQendcopy: resetting connection
    BEGIN
    CREATE
    INSERT 0 0
    UPDATE 0
    DROP
    COMMIT
    
    ---------------------------------------------------------------------------
    
    output i expected:
    
    UPDATE 1
    BEGIN
    CREATE
    INSERT 0 0
    UPDATE 0
    DROP
    COMMIT
    
    ---------------------------------------------------------------------------
    
    i compiled with all defaults except the install directory:
    ./configure  --prefix=/opt/pgsql
    
    we use the startup script from the documentation.
    it starts the database like this from rc.3:
    
    PGACCOUNT="postgres"
    POSTMASTER="postmaster"
    FACILITY="local5"
    PGLOGFILE="/tmp/postgres.log"
    PGOPTS="-i -d 0"
    . /etc/rc.d/init.d/functions
    . /etc/sysconfig/network
    su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} 2>&1 | logger -p
    ${FACILITY}.notice) &" > /dev/null 2>&1 &
    
    the bug can be reproduced in both
    
    PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66
    
    and 
    
    PostgreSQL 7.1beta2 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
    
    ---------------------------------------------------------------------------
    
    platform info:
    
    RedHat Linux 2.2.17 i686 unknown
    gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    256 MB RAM
    
    
    hope all this helps.
    
    -tfo