Re: [GENERAL] Data loading from a flat file...

2006-01-17 Thread Michelle Konzack
Am 2006-01-05 23:04:16, schrieb Angshu Kar: > Also, my data file is showing some ^M chars like > > B1^M C1^M E1 > B2^M C2^M E2 If those ^M are coming from your data file, then you should use dos2unix and the problem is gone Greetings Michelle Konzack Systemadministrat

Re: [GENERAL] Data loading from a flat file...

2006-01-06 Thread Bruno Wolff III
On Thu, Jan 05, 2006 at 23:04:55 -0600, Angshu Kar <[EMAIL PROTECTED]> wrote: > Could you please tell me what's the syntax with INSERT for this? http://developer.postgresql.org/docs/postgres/sql-insert.html ---(end of broadcast)--- TIP 2: Don't 'k

Re: [GENERAL] Data loading from a flat file...

2006-01-06 Thread Bricklen Anderson
Pandurangan R S wrote: To get rid of ^M characters you could use cat file | tr -d ^M you need to type ^V before you type ^M in the preceeding command. But ^V will not be displayed on the screen. Or you can use dos2unix/unix2dos, if installed. I believe they are in the sysutils package. ---

Re: [GENERAL] Data loading from a flat file...

2006-01-06 Thread Angshu Kar
No need for that. Everything works fine. I'm grateful pgsql. And thanks a ton Pandu:)On 1/6/06, Angshu Kar < [EMAIL PROTECTED]> wrote:Thanks a lot Pandu.Everything works ok. Now one last thing : I want to insert a fixed value to the D field in all rows. Any statement for that? On 1/6/06, Panduranga

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
Thanks a lot Pandu.Everything works ok. Now one last thing : I want to insert a fixed value to the D field in all rows. Any statement for that?On 1/6/06, Pandurangan R S <[EMAIL PROTECTED]> wrote: Issue the following command before you execute copyALTER TABLE DISTANCE ALTER COLUMN SET DEFAULT next

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Pandurangan R S
Issue the following command before you execute copy ALTER TABLE DISTANCE ALTER COLUMN SET DEFAULT nextval('') Btw, what version of postgres are you using? On 1/6/06, Angshu Kar <[EMAIL PROTECTED]> wrote: > here it is: > > >Table "public.distance" > Column|

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
here it is:   Table "public.distance"    Column    |   Type   | Modifiers--+--+--- distance_id  | integer  | not null  query_id              | integer  | not null subject_id            | integer 

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Pandurangan R S
Please show the output of describe command of the table On 1/6/06, Angshu Kar <[EMAIL PROTECTED]> wrote: > More problems solved and created - Now I'm getting the error: > > null value in column "subject_id" violates not-null constraint > > and this is nothing but column A which I talked about in

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Pandurangan R S
cat test | paste - - - This will merge three consecutive lines into a single line. Note that there is a space between each -. On 1/6/06, Angshu Kar <[EMAIL PROTECTED]> wrote: > More problems solved and created - Now I'm getting the error: > > null value in column "subject_id" violates not-null c

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
More problems solved and created - Now I'm getting the error: null value in column "subject_id" violates not-null constraintand this is nothing but column A which I talked about in the very beginning! Since its not null how can I COPY to B C and E. The same problem will arise with field E too! AKOn

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
Thanks for the chmod command Pandu but the cat command is not doing anything!And as Michael suggested that file has indeed carriage returns embedded in fields. I opened it in my windows m/c using textpad and got: B1    C1    E1B2    C2    E2...Any more suggestions on how to solve this? :(On 1/6/06,

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Pandurangan R S
To get rid of ^M characters you could use cat file | tr -d ^M you need to type ^V before you type ^M in the preceeding command. But ^V will not be displayed on the screen. You might need to change directory permission too. use chmod +rx . For this command to succeed you need to execute this co

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
I've solved the permission issue but now the error is:ERROR:  missing data for column "subject_entry_id" CONTEXT:  COPY distance, line 1: "107128"I feel the ^M is creating the problem! Any means to remove that? I mean using the delimiters option? On 1/6/06, Angshu Kar <[EMAIL PROTECTED]> wrote: Tha

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
Thanks Michael.I'm using PgAdmin III 1.4.0 from my WinXP m/c to access the DB in my linux m/c! The file has about 2GB data.It returns back to the prompt very soon.I'm using less or vi command to view the file and getting those ^M as mentioned (i.e. between fields). Any clue how I can massage the d

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Michael Fuhr
On Thu, Jan 05, 2006 at 11:04:16PM -0600, Angshu Kar wrote: > Thanks Jim. the statement is running without any error but nothing is > getting copied into the table! What client are you using and what's the exact command you ran? Does the command finish or does it never return? How much data is th

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Michael Fuhr
On Thu, Jan 05, 2006 at 10:51:55PM -0600, Angshu Kar wrote: > I've a table schema in pg say as: > > (A B C D E) > > where none of these fields allow null. > > Now, I've a flat file that has got tab-delimited data for B,C and E fields. > And A,B come from sequences. > > Could anyone please let m

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
Could you please tell me what's the syntax with INSERT for this?On 1/5/06, Bruno Wolff III <[EMAIL PROTECTED]> wrote: On Thu, Jan 05, 2006 at 22:51:55 -0600,  Angshu Kar < [EMAIL PROTECTED]> wrote:> Hi Pgsql,>> I've a table schema in pg say as:>> (A B C D E)>> where none of these fields allow null.

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Angshu Kar
Thanks Jim. the statement is running without any error but nothing is getting copied into the table!Also, my data file is showing some ^M chars likeB1^M   C1^M   E1B2^M   C2^M   E2... Does anyone know what can it represent?Is it creating any trouble for the COPY command?And can we use INSERT with C

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Bruno Wolff III
On Thu, Jan 05, 2006 at 22:51:55 -0600, Angshu Kar <[EMAIL PROTECTED]> wrote: > Hi Pgsql, > > I've a table schema in pg say as: > > (A B C D E) > > where none of these fields allow null. > > Now, I've a flat file that has got tab-delimited data for B,C and E fields. > And A,B come from sequen

Re: [GENERAL] Data loading from a flat file...

2006-01-05 Thread Jim C. Nasby
On Thu, Jan 05, 2006 at 10:51:55PM -0600, Angshu Kar wrote: > Hi Pgsql, > > I've a table schema in pg say as: > > (A B C D E) > > where none of these fields allow null. > > Now, I've a flat file that has got tab-delimited data for B,C and E fields. > And A,B come from sequences. > > Could anyo