Обсуждение: Copy command (bug??)

Поиск
Список
Период
Сортировка

Copy command (bug??)

От
roboccc@t-online.de (Bogdan Chytrek)
Дата:
hi folks,

as i'm new, i'm not sure if this forum is the right one. i found a bug,
maybe in postgresql 7.2.1 or in my brain (you tell me):

i want to copy a table from one datbase (DB1) to another (DB2).
So i start psql with DB1 and execute:

\copy phfields to phfields.bak using delimiters '"'
\q

then i start psql again with DB2 and execute:

\copy fields from phfields.bak using delimiters '"'

ok, i also changed the name of the table. but the problem is: i receive the
following message:

ERROR: copy: line 1, pg_atoi: error in "VARCHAR(16)": can't parse
"VARCHAR(16)"

psql just produced the file phfields.bak. Why is it a problem to read it? Is
just some seconds later and i did not touch the .bak-file manually.

thanks in advance
--------------------------- the create-table command --------------
CREATE TABLE  fields (
 pflid SERIAL PRIMARY KEY,
 pfltbl VARCHAR(16),
 pflindx INTEGER,
 pflname VARCHAR(16),
 pflaname VARCHAR(32),
 pfldlevel INTEGER,
 pflmlevel INTEGER,
 pfldefstr INTEGER,
 pflcomment INTEGER,
 pflsorti INTEGER,
 pflquickv INTEGER,
 pflselv INTEGER,
 pflinput INTEGER,
 pflupdate INTEGER,
 pflconv INTEGER,
 pflres15 INTEGER,
 pflres16 INTEGER
 );
----------------- some records of the .bak-file: ---------------
2"phfields"1"pfltbl"Tabelle"12"14"VARCHAR(16)"Name der Tabelle, in der sich
die Variable befindet"\N"\N"\N"\N"\N"\N"\N"\N
3"phfields"2"pflindx"Nr. in Tabelle"12"14"INTEGER"Index der Variablen in
ihrer Tabelle"\N"\N"\N"\N"\N"\N"\N"\N
1"phfields"0"pflid"Index"12"14"SERIAL PRIMARY KEY"Index der Einträge in
phfields"\N"\N"\N"\N"\N"\N"\N"\N
4"phfields"3"pflname"Feldname"12"14"VARCHAR(16)"Variablenname in
DB-Tabelle"\N"\N"\N"\N"\N"\N"\N"\N
5"phfields"4"pflaname"Anzeigename"12"14"VARCHAR(32)"Name der angezeigt
wird"\N"\N"\N"\N"\N"\N"\N"\N
6"phfields"5"pfldlevel"Anzeigeberechtigung"12"14"INTEGER"Mindsetberechtigung
zur Anzeige des Feldes"\N"\N"\N"\N"\N"\N"\N"\N
7"phfields"6"pflmlevel"Modif. Brechtigung"12"14"INTEGER"Mindestberechtigung
zur Modifikation des Feldes"\N"\N"\N"\N"\N"\N"\N"\N
17"phfields"7"pfldefstr"Definition"12"14"INTEGER"Definitions
String"\N"\N"\N"\N"\N"\N"\N"\N
--------------------------- the end ----------------------------
this table describes entries in other tables!


Bogdan

mailto:bogdan@chytrek.de

p.s. How do i see the answers to that posting???


Re: Copy command (bug??)

От
Jeff Eckermann
Дата:
--- Bogdan Chytrek <roboccc@t-online.de> wrote:
> hi folks,
>
> as i'm new, i'm not sure if this forum is the right
> one. i found a bug,
> maybe in postgresql 7.2.1 or in my brain (you tell
> me):
>
> i want to copy a table from one datbase (DB1) to
> another (DB2).
> So i start psql with DB1 and execute:
>
> \copy phfields to phfields.bak using delimiters '"'
> \q
>
> then i start psql again with DB2 and execute:
>
> \copy fields from phfields.bak using delimiters '"'
>
> ok, i also changed the name of the table. but the
> problem is: i receive the
> following message:
>
> ERROR: copy: line 1, pg_atoi: error in
> "VARCHAR(16)": can't parse
> "VARCHAR(16)"
>
> psql just produced the file phfields.bak. Why is it
> a problem to read it? Is
> just some seconds later and i did not touch the
> .bak-file manually.
>
> thanks in advance
> --------------------------- the create-table command
> --------------
> CREATE TABLE  fields (
>  pflid SERIAL PRIMARY KEY,
>  pfltbl VARCHAR(16),
>  pflindx INTEGER,
>  pflname VARCHAR(16),
>  pflaname VARCHAR(32),
>  pfldlevel INTEGER,
>  pflmlevel INTEGER,
>  pfldefstr INTEGER,
>  pflcomment INTEGER,
>  pflsorti INTEGER,
>  pflquickv INTEGER,
>  pflselv INTEGER,
>  pflinput INTEGER,
>  pflupdate INTEGER,
>  pflconv INTEGER,
>  pflres15 INTEGER,
>  pflres16 INTEGER
>  );
> ----------------- some records of the .bak-file:
> ---------------
> 2"phfields"1"pfltbl"Tabelle"12"14"VARCHAR(16)"Name
> der Tabelle, in der sich
> die Variable befindet"\N"\N"\N"\N"\N"\N"\N"\N

You must have changed the table definition.  There is
no way that you could store strings (VARCHAR(16), for
example) in an integer column, which is what COPY is
complaining about.

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com