Thread

  1. pg_dump error

    jose' soares <sferac@bo.nettuno.it> — 1998-05-19T12:24:31Z

    Hi all,
    
    I think there's an error on pg_dump, 
    my environment is:
             Lynux 2.0.33
    	 PostgreSQL 6.3
    
    1) ----VARCHAR(-50)------------------------------------------
    
    I created a table as:
    CREATE TABLE utente (
    	intestazione_azienda 	varchar,
    	indirizzo 		varchar
    	);
    
    using pg_dump -d mydatabase > file
    
    file is like:
    \connect - postgres
    CREATE TABLE utente (intestazione_azienda varchar(-5), indirizzo varchar(-5));
    
    if I try to load it using
    psql -d mydatabase < file
    I have this:
    
    ERROR:  length for 'varchar' type must be at least 1
    
    2) ----CONSTRAINT--------------------------------------------
    
    I created a table like:
    
    CREATE TABLE attivita_a (
    	azienda			CHAR(11) NOT NULL,
    	attivita		CHAR(03) NOT NULL,
    	operatore		CHAR(03),	
    	vet_esterno		VARCHAR(45),
    	tipo_allevamento1	CHAR(02),		
    	tipo_allevamento2	CHAR(02),
    	esonerato		CHAR CHECK(esonerato = 'S' OR esonerato = 'N'),
    	razza_prevalente1	CHAR(03),	
    	razza_prevalente2	CHAR(03),		
    	iscrizione_libro	DATE,
    	iscritta_funzionali	CHAR CHECK(iscritta_funzionali = 'S' OR iscritta_funzionali = 'N'),
    	iscritta_tutela		CHAR CHECK(iscritta_tutela = 'S' OR iscritta_tutela = 'N'),
    	sigla_tutela		CHAR(04),
    	adesione_altri_piani	VARCHAR(50),
    	data_adesione		DATE,
            PRIMARY KEY (azienda,attivita)
    	);
    
    
    using pg_dump I have this:
    
    \connect - postgres
    CREATE TABLE attivita_a (
     azienda 		char(11) NOT NULL,
     attivita 		char(3) NOT NULL,
     operatore 		char(3),
     vet_esterno 		varchar(45),
     tipo_allevamento1 	char(2),
     tipo_allevamento2 	char(2),
     esonerato 		char,
     razza_prevalente1 	char(3),
     razza_prevalente2 	char(3),
     iscrizione_libro 	date,
     iscritta_funzionali 	char,
     iscritta_tutela 	char,
     sigla_tutela 		char(4),
     adesione_altri_piani 	varchar(50),
     data_adesione date)
     CONSTRAINT attivita_a_esonerato CHECK esonerato = 'S' OR esonerato = 'N',
     CONSTRAINT attivita_a_iscritta_funzionali CHECK iscritta_funzionali = 'S' OR iscritta_funzionali = 'N',
     CONSTRAINT attivita_a_iscritta_tutela CHECK iscritta_tutela = 'S' OR iscritta_tutela = 'N';
    --
    Note that CONSTRAINTs are the wrong syntax, they are defined after the close
    parenthesis of CREATE TABLE.
    
    3)----VIEWS-------------------------------------------------
    I have some views on my database but seems that pg_dump doesn't see those
    views.
                                                                       Jose'
    
    
    
  2. Re: [HACKERS] pg_dump error

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-06-16T03:19:07Z

    > 
    > Hi all,
    > 
    > I think there's an error on pg_dump, 
    > my environment is:
    >          Lynux 2.0.33
    > 	 PostgreSQL 6.3
    > 
    > 1) ----VARCHAR(-50)------------------------------------------
    > 
    > I created a table as:
    > CREATE TABLE utente (
    > 	intestazione_azienda 	varchar,
    > 	indirizzo 		varchar
    > 	);
    > 
    > using pg_dump -d mydatabase > file
    > 
    > file is like:
    > \connect - postgres
    > CREATE TABLE utente (intestazione_azienda varchar(-5), indirizzo varchar(-5));
    
    Basically, something major is wrong in your installation.  I have never
    heard a report like this, and people use pg_dump all the time.
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)
    
    
  3. Re: [HACKERS] pg_dump error

    jose' soares <sferac@bo.nettuno.it> — 1998-06-16T11:18:16Z

    On Mon, 15 Jun 1998, Bruce Momjian wrote:
    
    > > 
    > > Hi all,
    > > 
    > > I think there's an error on pg_dump, 
    > > my environment is:
    > >          Lynux 2.0.33
    > > 	 PostgreSQL 6.3
    > > 
    > > 1) ----VARCHAR(-50)------------------------------------------
    > > 
    > > I created a table as:
    > > CREATE TABLE utente (
    > > 	intestazione_azienda 	varchar,
    > > 	indirizzo 		varchar
    > > 	);
    > > 
    > > using pg_dump -d mydatabase > file
    > > 
    > > file is like:
    > > \connect - postgres
    > > CREATE TABLE utente (intestazione_azienda varchar(-5), indirizzo varchar(-5));
    > 
    > Basically, something major is wrong in your installation.  I have never
    > heard a report like this, and people use pg_dump all the time.
    > 
    I have three bugs Bruce:
    
    1)  VARCHAR(-5)
    2)  CONSTRAINTs wrong syntax
    3)  no VIEWs ??
    
    hygea=> create table prova (var varchar, bp bpchar check (bp='zero'));
    CREATE
    hygea=> create view wprova as select var from prova;
    CREATE
    
    pg_dump hygea -s prova
    
    \connect - postgres
    CREATE TABLE prova (var varchar(-5), bp char(-5)) CONSTRAINT prova_bp CHECK bp
    =COPY prova FROM stdin;
    \.
                                                    Jose'