From: | "Markova, Nina" <nmarkova(at)NRCan(dot)gc(dot)ca> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | FW: How to upload data to postgres |
Date: | 2008-09-09 20:54:12 |
Message-ID: | 6D8C7E015447D0428D80E9DBABA06A1E03F4AA5C@S0-OTT-X2.nrn.nrcan.gc.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
So far I tried;
1) I have copied data from Ingres in ASCII (using Ingres copydb
command).
2) created a table in a Postgres database
3) tried loading data into Potgres table - encounter problems.
For 1) (the Ingres part)
=====================
Ingres used the following copy commands:
copy site(
sta= varchar(0)tab,
ondate= varchar(0)tab,
offdate= varchar(0)tab,
lat= c0tab,
lon= c0tab,
elev= c0tab,
regist_code= varchar(0)tab,
vault_cond= varchar(0)tab,
geology= varchar(0)tab,
comment= varchar(0)tab,
initials= varchar(0)tab,
lddate= c0nl,
nl= d0nl)
into '/tmp/site.dba'
Normally Ingres will use this command to copy data from a file:
copy site(
sta= varchar(0)tab,
ondate= varchar(0)tab,
offdate= varchar(0)tab,
lat= c0tab,
lon= c0tab,
elev= c0tab,
regist_code= varchar(0)tab,
vault_cond= varchar(0)tab,
geology= varchar(0)tab,
comment= varchar(0)tab,
initials= varchar(0)tab,
lddate= c0nl,
nl= d0nl)
from '/vm04-0/home/postgres/test/site.dba'
For 3)
=====
- I got error when I tried to copy with Ingres-like copy command.
- Then I tried to copy with simple 'copy site from
'/vm04-0/home/postgres/test/site-c.dba' - ERROR: value too long for
type character varying(5)
- I had no luck either when used binary copying - postgres complained
about signature:
copy site from '/vm04-0/home/postgres/test/site.dba' with binary
:
ERROR: COPY file signature not recognized
========================
I have couple of questions as well.
========================
Q1: is there an equivalent of copydb in postgres (in Ingres copydb
creates copy statements for all database tables in a single file)
Q2: how to say in postgres that a field has no default values (in
Ingres 'not default' is used - and this produced an error in postgres
CREATE TABLE command)
Create table site (
sta varchar(5) not null,
ondate varchar(8) not null,
offdate varchar(8) not null,
lat float not null not default, ----->
lon float not null not default
)
Q3: How to specify storage structure of a table (again in Ingres
'modify' statement is used to specify btree, isam or hash structure). In
the Postgres documentation I only saw how to create an index with a
specific structure.
In Ingres: modify site to isam unique on sta, ondate (means structure
isam, primary key is on 2 fields - sta and ondate)
Thanks in advance,
Nina
> ______________________________________________
> From: Markova, Nina
> Sent: September 9, 2008 14:32
> To: pgsql-general(at)postgresql(dot)org
> Subject: How to upload data to postgres
>
> Hi again,
>
> I need to load data from Ingres database to Postgres database. What's
> the easiest way?
>
> Thanks,
> Nina
>
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-09-09 22:04:21 | Re: Source of User Defined functions. |
Previous Message | Saii | 2008-09-09 20:49:40 | Source of User Defined functions. |
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Hodgson | 2008-09-09 20:57:58 | Re: LEFT JOIN issue |
Previous Message | Mohd Fahadullah | 2008-09-09 20:50:26 | Server installation problem using freebsd ports |