Re: [SQL] copy from csv, variable filename within a function

2013-04-18 Thread bricklen
Note: "DELEMITER" should be "DELIMITER". On Thu, Apr 18, 2013 at 1:34 AM, basti wrote: > I have fixed it with dollar-quoting. > > Original-Nachricht Betreff: [SQL] copy from csv, > variable filename within a function Datum: Thu, 18 Apr 2

Fwd: [SQL] copy from csv, variable filename within a function

2013-04-18 Thread basti
I have fixed it with dollar-quoting. Original-Nachricht Betreff:[SQL] copy from csv, variable filename within a function Datum: Thu, 18 Apr 2013 09:26:09 +0200 Von:basti An: pgsql-sql@postgresql.org Hello, i have try the following: -- Function

[SQL] copy from csv, variable filename within a function

2013-04-18 Thread basti
n NOT NULL, CONSTRAINT tmp_raw_data_pkey PRIMARY KEY ("timestamp") ) ON COMMIT DROP; --copy tmp_raw_data( -- "timestamp", temp_in, pressure, temp_out, humidity, wdir, wspeed) --FROM '/home/wetter/csv/data/raw/2013/2013-04/2013-04-16.txt' --WITH DEL

Re: [SQL] copy users/groups

2013-01-08 Thread Adrian Klaver
On 01/08/2013 07:08 AM, Edward W. Rouse wrote: We have a database that was updated from 7.4.1 to 9.1.3. I've gotten everything working, but now it seems that the users and groups weren't restored. Probably because they weren't backed up. Is there a way to dump just the users and groups, plus the

[SQL] copy users/groups

2013-01-08 Thread Edward W. Rouse
We have a database that was updated from 7.4.1 to 9.1.3. I've gotten everything working, but now it seems that the users and groups weren't restored. Probably because they weren't backed up. Is there a way to dump just the users and groups, plus the passwords and permissions, and restore them witho

Re: [SQL] \copy multiline

2012-11-29 Thread Sebastian P . Luque
On Thu, 29 Nov 2012 10:33:37 +0100, Guillaume Lelarge wrote: > On Wed, 2012-11-28 at 21:21 -0600, Seb wrote: >> Hi, >> I use \copy to output tables into CSV files: >> \copy (SELECT ...) TO 'a.csv' CSV >> but for long and complex SELECT statements, it is cumbersome and >> confusing to write eve

Re: [SQL] \copy multiline

2012-11-29 Thread Sebastian P . Luque
On Thu, 29 Nov 2012 08:01:31 +, Ben Morrow wrote: > Quoth splu...@gmail.com (Seb): >> I use \copy to output tables into CSV files: >> \copy (SELECT ...) TO 'a.csv' CSV >> but for long and complex SELECT statements, it is cumbersome and >> confusing to write everything in a single line, and

Re: [SQL] \copy multiline

2012-11-29 Thread Rob Sargentg
On 11/29/2012 02:33 AM, Guillaume Lelarge wrote: On Wed, 2012-11-28 at 21:21 -0600, Seb wrote: Hi, I use \copy to output tables into CSV files: \copy (SELECT ...) TO 'a.csv' CSV but for long and complex SELECT statements, it is cumbersome and confusing to write everything in a single line, an

Re: [SQL] \copy multiline

2012-11-29 Thread Guillaume Lelarge
On Wed, 2012-11-28 at 21:21 -0600, Seb wrote: > Hi, > > I use \copy to output tables into CSV files: > > \copy (SELECT ...) TO 'a.csv' CSV > > but for long and complex SELECT statements, it is cumbersome and > confusing to write everything in a single line, and multiline statements > don't seem

[SQL] \copy multiline

2012-11-28 Thread Seb
Hi, I use \copy to output tables into CSV files: \copy (SELECT ...) TO 'a.csv' CSV but for long and complex SELECT statements, it is cumbersome and confusing to write everything in a single line, and multiline statements don't seem to be accepted. Is there an alternative, or am I missing an con

Re: [SQL] COPY without quoting

2012-03-15 Thread Lee Hachadoorian
On 03/15/2012 12:23 PM, Tom Lane wrote: Lee Hachadoorian writes: COPY ... TO ... WITH CSV defaults to quoting string fields with embedded delimiters, quotes, and newlines. In pgAdmin I can execute to file and specify "no quoting" for the output, in which case I get (what I want) a file with no

Re: [SQL] COPY without quoting

2012-03-15 Thread Tom Lane
Lee Hachadoorian writes: > COPY ... TO ... WITH CSV defaults to quoting string fields with embedded > delimiters, quotes, and newlines. In pgAdmin I can execute to file and > specify "no quoting" for the output, in which case I get (what I want) a > file with no quotes, even though there are em

[SQL] COPY without quoting

2012-03-15 Thread Lee Hachadoorian
COPY ... TO ... WITH CSV defaults to quoting string fields with embedded delimiters, quotes, and newlines. In pgAdmin I can execute to file and specify "no quoting" for the output, in which case I get (what I want) a file with no quotes, even though there are embedded commas in the strings. But

[SQL] \COPY in psql using \e

2011-11-02 Thread Ivan Sergio Borgonovo
I'm connecting to a DB with psql -h host DB once in psql I'd like to \e create temp table t1 ...; \copy t1 from 'filename' ... select * from t1; [ESC]:x what I get is: CREATE TABLE ERROR: syntax error at or near "select" LINE 3: select * from t1; ^ \copy: ERROR: syntax error at or n

Re: [SQL] COPY with FORMAT in Postgresql 9.x

2010-12-03 Thread Tom Lane
Humair Mohammed writes: > Postgres 9.x provies the COPY command with new syntax with a new option > called FORMAT > http://www.postgresql.org/docs/current/static/sql-copy.html > However when I run the following command: > COPY dQstn FROM 'c:/bcp/postgres/dQstn.csv' WITH FORMAT csv; > I get the fo

[SQL] COPY with FORMAT in Postgresql 9.x

2010-12-02 Thread Humair Mohammed
Postgres 9.x provies the COPY command with new syntax with a new option called FORMAT http://www.postgresql.org/docs/current/static/sql-copy.html However when I run the following command: COPY dQstn FROM 'c:/bcp/postgres/dQstn.csv' WITH FORMAT csv; I get the following error message: ERROR: synt

Re: [SQL] COPY command and required file permissions

2010-06-25 Thread Adrian Klaver
On Friday 25 June 2010 6:07:35 pm Bruno Scovoli Santos wrote: > * Are you connecting to the database as a superuser to run the COPY > command? * > > Yes. This \copy command is in the database build script (create table > blablabla). So it almost (I think) must have to be a superuser. > > But he

Re: [SQL] COPY command and required file permissions

2010-06-25 Thread Adrian Klaver
On 06/23/2010 02:01 PM, bruno.scovoli wrote: I have an script with many "\copy" commands. For example: \copy privilegios from '/work/eclipse-workspace/Canoan Server/database/load/privilegios.dat' \copy privilegios_de_usuarios from '/work/eclipse-workspace/Canoan Server/database/load/privilegios

Re: [SQL] COPY command and required file permissions

2010-06-25 Thread bruno.scovoli
I have an script with many "\copy" commands. For example: \copy privilegios from '/work/eclipse-workspace/Canoan Server/database/load/privilegios.dat' \copy privilegios_de_usuarios from '/work/eclipse-workspace/Canoan Server/database/load/privilegios_de_usuarios.dat' \copy classificacoes from '/w

Re: [SQL] Copy question

2008-12-29 Thread Guillaume Lelarge
Judith Altamirano a écrit : > Hello every body I'm trying to extract a query as follows: > > copy (select * from clientes where id_cliente = 7895) to > '/home/paso/sel.copy'; > > But it returns the next error: > > ERROR: error de sintaxis en o cerca de «(» at character 6 > LINE 1: copy (select

[SQL] Copy question

2008-12-29 Thread Judith Altamirano
Hello every body I'm trying to extract a query as follows: copy (select * from clientes where id_cliente = 7895) to '/home/paso/sel.copy'; But it returns the next error: ERROR: error de sintaxis en o cerca de «(» at character 6 LINE 1: copy (select * from clientes where id_cliente = 7895) to

[SQL] COPY TO with FORCE QUOTE *

2008-08-18 Thread Jackson Pauls
I would like to be able to force quotes on all columns in the COPY TO command without having to name all columns explicitly. E.g.: COPY a TO '/tmp/a.csv' WITH CSV FORCE QUOTE *; Reading the documentation, there doesn't seem to be a way to do this. Am I missing something? If not, could I submit th

Re: [SQL] COPY equivalent for updates

2008-07-15 Thread Decibel!
On Jul 15, 2008, at 1:10 AM, Ivan Sergio Borgonovo wrote: I'd like to UPDATE t1 (col1, col2, col3) from file with @1 as primary key; or UPDATE t1 (col1, col2, col3) from file where @1=id; sort of... Sorry, there's nothing like COPY for UPDATE. Otherwise what is the fastest approach? I can

[SQL] COPY equivalent for updates

2008-07-14 Thread Ivan Sergio Borgonovo
Is there a COPY equivalent for updates? eg I've create table t1 ( id int primary key, col1 int, col2 int, col3 varchar(32) ); and a CSV file 10,4,5,"abc" 13,7,3,"def" 18,12,77,"ghi" I'd like to UPDATE t1 (col1, col2, col3) from file with @1 as primary key; or UPDATE t1 (col1, col2, col

Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Harold A. Giménez Ch.
Thanks for the info. SELinux was the guilty party... On Thu, Jun 12, 2008 at 10:48 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=" <[EMAIL PROTECTED]> > writes: > > In migrating an application from sql server to Postgres, I created a ruby > > script that extra

Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Tom Lane
"=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=" <[EMAIL PROTECTED]> writes: > In migrating an application from sql server to Postgres, I created a ruby > script that extracts csv files from sql server (from a windows box), then > SCPs them into a directory (/home/ruby_process) on the server running > Po

Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Pavel Stehule
2008/6/12 Harold A. Giménez Ch. <[EMAIL PROTECTED]>: > Hi all, > In migrating an application from sql server to Postgres, I created a ruby > script that extracts csv files from sql server (from a windows box), then > SCPs them into a directory (/home/ruby_process) on the server running > Postgres (

[SQL] COPY command and required file permissions

2008-06-12 Thread Harold A. Giménez Ch.
Hi all, In migrating an application from sql server to Postgres, I created a ruby script that extracts csv files from sql server (from a windows box), then SCPs them into a directory (/home/ruby_process) on the server running Postgres (a Fedora core 8) and finally runs the Postgres COPY command for

Re: [SQL] copy command and array of composite types?

2008-03-25 Thread Guy Fraser
Try to export some data from the table using "copy from ..." to see what it looks like. On 2008-Mar-25, at 12:19, Jon Norman wrote: I'm using PostgreSQL 8.3.1. I've created the following composite type: CREATE TYPE expression_event_type AS ( event_id varchar(10), expr_indices smallint[] )

[SQL] copy command and array of composite types?

2008-03-25 Thread Jon Norman
I'm using PostgreSQL 8.3.1. I've created the following composite type: CREATE TYPE expression_event_type AS ( event_id varchar(10), expr_indices smallint[] ); which is used with the following table definition: CREATE TABLE boolean_expr_table( expr_id smallint PRIMARY KEY, expr_name varchar(100)

Re: [SQL] COPY FROM query

2007-02-12 Thread Steve Midgley
Hi, For what it's worth, WindowsXP (at least) seems to currently support forward slashes at the OS level, so this Postgres behavior isn't as odd as it might seem. If you enclose your paths with double quote (") marks, Windows will even accept Unix style paths for some instructions on the comm

Re: [SQL] COPY FROM query.

2007-02-12 Thread Richard Huxton
Paul Lambert wrote: Phillip Smith wrote: "Having said that, if I switch it to a forward slash it works without error... odd, given that weenblows standard is backslash." Yes, but PostgreSQL uses a back-slash as an escape character, which needs to be used to escape itself at an application lev

Re: [SQL] COPY FROM query.

2007-02-11 Thread Paul Lambert
Phillip Smith wrote: "Having said that, if I switch it to a forward slash it works without error... odd, given that weenblows standard is backslash." Yes, but PostgreSQL uses a back-slash as an escape character, which needs to be used to escape itself at an application level before the O/S gets

Re: [SQL] COPY FROM query.

2007-02-11 Thread Phillip Smith
al with it :) -p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Lambert Sent: Monday, 12 February 2007 11:09 To: Joe Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY FROM query. Joe wrote: > Hi Paul, > > On Mon, 2007-02-12 at 08:19 +0900,

Re: [SQL] COPY FROM query.

2007-02-11 Thread Paul Lambert
Joe wrote: Hi Paul, On Mon, 2007-02-12 at 08:19 +0900, Paul Lambert wrote: I'm attempting to copy from a table into a file using a select query inside the copy. The following is my command: COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM appraisals_temp) TO 'c:\autodrs_appraisal_ne

Re: [SQL] COPY FROM query.

2007-02-11 Thread Joe
Hi Paul, On Mon, 2007-02-12 at 08:19 +0900, Paul Lambert wrote: > I'm attempting to copy from a table into a file using a select query > inside the copy. > > The following is my command: > > COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM > appraisals_temp) TO 'c:\autodrs_appraisal_ne

Re: [SQL] COPY FROM query.

2007-02-11 Thread Paul Lambert
An INSERT INTO will fix my problem with needing the extra copy from and copy to. I'm still curious as to why i was being told I couldn't specify a relative path though. P. -- Paul Lambert Database Administrator AutoLedgers ---(end of broadcast)--

[SQL] COPY FROM query.

2007-02-11 Thread Paul Lambert
I'm attempting to copy from a table into a file using a select query inside the copy. The following is my command: COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM appraisals_temp) TO 'c:\autodrs_appraisal_new.txt' WITH DELIMITER AS '^' CSV HEADER; I get the following returned: WAR

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
That works like a charm. Thanks, Alvaro! -Jeff -Original Message- From: Alvaro Herrera [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 1:22 PM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY FROM - force a value Demel, Jeff wrote: > Is there a way

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Alvaro Herrera
Demel, Jeff wrote: > Is there a way to force a value when you're doing a COPY FROM, importing > a file into a table? > > Here's my query as it is now: > > COPY filetable (value1, value2, value3, value4, forcevalue1, > forcevalue2) > FROM 'C:\\InsertFiles\\thisfile.txt' > WITH DELIMITER AS ' '

[SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
Is there a way to force a value when you're doing a COPY FROM, importing a file into a table? Here's my query as it is now: COPY filetable (value1, value2, value3, value4, forcevalue1, forcevalue2) FROM 'C:\\InsertFiles\\thisfile.txt' WITH DELIMITER AS ' ' ; The file only contains data for

Re: [SQL] "Copy from" omit source columns?

2006-11-21 Thread Aaron Bono
On 11/21/06, Steve Midgley <[EMAIL PROTECTED]> wrote: Hello, (I already fear the answer to my question is "no..") :) I am using the 'COPY FROM' SQL command (not psql \copy) to move data into a table from a CSV file. The source data are suitable for import EXCEPT there are extraneous columns of

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread Phillip Smith
No, it was me that didn't understand!! But I do now - quite simple really! Cheers, -p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Bono Sent: Wednesday, 14 June 2006 10:41 AM To: [EMAIL PROTECTED] Cc: pgsql-sql@postgresql.org Subject: Re:

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread Aaron Bono
I guess I still don't understand... If you take the approach operationsengineer1 and I suggested, you should only need 3 or 4 tables regardless of the number of SYS file records. Good luck with your implementation. -Aaron On 6/13/06, Phillip Smith <[EMAIL PROTECTED]> wrote: Thanks Aaron - The

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread Phillip Smith
hanks again, -p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Bono Sent: Wednesday, 14 June 2006 1:05 AM To: [EMAIL PROTECTED] Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY to table with array columns (Longish) So how about creating a sys

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread operationsengineer1
text | > > a6 | text | > > a7 | text | > > a8 | text | > > a9 | text | > > Indexes: > > "id" PRIMARY KEY, btree (a0) > > > > a0 = primary key - eg, ZPRECMPL or ZKCOST > > > >

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread operationsengineer1
| >a4 | text | >a5 | text | >a6 | text | >a7 | text | >a8 | text | >a9 | text | > Indexes: > "id" PRIMARY KEY, btree (a0) > > a0 = primary key - eg, ZPRECMPL or ZKCOST &

Re: [SQL] COPY to table with array columns (Longish)

2006-06-13 Thread Aaron Bono
So how about creating a sys table too: SYS sys_id ZKCOST sys_id, zkcost_id, zkcost_value and ZPRECMPL sys_id, zprecmpl_id, zprecmpl_value This gives you the flexibility to expand to as many "columns" for ZPRECMPL as you want. The bottom line is, I think it would be much more ef

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Phillip Smith
RIMARY KEY, btree (a0) a0 = primary key - eg, ZPRECMPL or ZKCOST -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Bono Sent: Tuesday, 13 June 2006 2:12 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY to table with array columns (Longish)

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Aaron Bono
I think two tables should suffice: ZKCOST and ZPRECMPL. So you would have ZKCOST zkcost_id, zkcost_value and ZPRECMPL zkcost_id, zprecmpl_id, zprecmpl_value where zkcost_id is the primary key for ZKCOST and zkcost_id, zprecmpl_id together are the primary key for ZPRECMPL and zk

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Richard Broersma Jr
> On Mon, 2006-06-12 at 21:58 -0500, Aaron Bono wrote: > > I agree with Tom. Personally I cannot think of a time I would use an > > array column over a child table. Maybe someone can enlighten me on > > when an array column would be a good choice. > > Arrays are a good choice when the data comes

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Rod Taylor
On Mon, 2006-06-12 at 21:58 -0500, Aaron Bono wrote: > I agree with Tom. Personally I cannot think of a time I would use an > array column over a child table. Maybe someone can enlighten me on > when an array column would be a good choice. Arrays are a good choice when the data comes naturally s

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Phillip Smith
om: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Bono Sent: Tuesday, 13 June 2006 12:58 PM To: Tom Lane Cc: [EMAIL PROTECTED]; pgsql-sql@postgresql.org Subject: Re: [SQL] COPY to table with array columns (Longish)   I agree with Tom.  Personally I cannot think of a time I woul

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Aaron Bono
I agree with Tom.  Personally I cannot think of a time I would use an array column over a child table.  Maybe someone can enlighten me on when an array column would be a good choice.What language are you using to do the export if I may ask? -AaronOn 6/12/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Phi

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Tom Lane
"Phillip Smith" <[EMAIL PROTECTED]> writes: > The whole sys file is variable length records like this - they range = > from 1 > to over 17,000 fields per record. 17000? I think you really need to rethink your schema. While you could theoretically drop 17000 elements into a PG array column, you w

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Phillip Smith
12:36 AM To: [EMAIL PROTECTED] Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY to table with array columns (Longish)   Can you provide an example? Thanks, Aaron On 6/11/06, Phillip Smith <[EMAIL PROTECTED] > wrote: Hi All,   Hope someone can help me – our main company system ru

Fwd: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Aaron Bono
Can you provide an example?Thanks,AaronOn 6/11/06, Phillip Smith <[EMAIL PROTECTED] > wrote: Hi All,   Hope someone can help me – our main company system runs on Raining Data PICK/D3 (if anyone familiar with it) which stores records in it's "tables" as variable length items. Every

[SQL] COPY to table with array columns (Longish)

2006-06-11 Thread Phillip Smith
Hi All,   Hope someone can help me – our main company system runs on Raining Data PICK/D3 (if anyone familiar with it) which stores records in it’s “tables” as variable length items. Every item has a unique Primary Key (per table) then each item can have a variable number of fields. These

Re: [SQL] COPY tablename FROM and null values

2006-03-22 Thread Tom Lane
ivan marchesini <[EMAIL PROTECTED]> writes: > I have a .txt file, containing some tabular data, where data are > delimited by TABs. > there are 3 columns: > column1 int4, column2 float8, column3 float8 > the problem is that column3 contains also null values (i.e. sometimes is > empty) This should

Re: [SQL] COPY tablename FROM and null values

2006-03-22 Thread JSP
yup... Replace the empty spaces in the file with some other value... replace null values with \N then try COPYing againOn 3/22/06, Luckys <[EMAIL PROTECTED]> wrote: On 3/22/06, Achilleus Mantzios < [EMAIL PROTECTED]> wrote: O ivan marchesini έγραψε στις Mar 22, 2006 :> Dear users,> I'm working

Re: [SQL] COPY tablename FROM and null values

2006-03-22 Thread Luckys
On 3/22/06, Achilleus Mantzios <[EMAIL PROTECTED]> wrote: O ivan marchesini έγραψε στις Mar 22, 2006 :> Dear users,> I'm working on a Postgres 7.4 server>> I have a .txt file, containing some tabular data, where data are> delimited by TABs.> there are 3 columns:>> column1 int4, column2 float8, co

Re: [SQL] COPY tablename FROM and null values

2006-03-22 Thread Achilleus Mantzios
O ivan marchesini έγραψε στις Mar 22, 2006 : > Dear users, > I'm working on a Postgres 7.4 server > > I have a .txt file, containing some tabular data, where data are > delimited by TABs. > there are 3 columns: > > column1 int4, column2 float8, column3 float8 > > the problem is that column3 con

[SQL] COPY tablename FROM and null values

2006-03-22 Thread ivan marchesini
Dear users, I'm working on a Postgres 7.4 server I have a .txt file, containing some tabular data, where data are delimited by TABs. there are 3 columns: column1 int4, column2 float8, column3 float8 the problem is that column3 contains also null values (i.e. sometimes is empty) so when I try to

[SQL] FW: sql copy does not work

2006-03-02 Thread Aniko.Badzong
Title: FW: sql copy does not work Hi I have a problem with the copy command. I need to write a Perl script where I copy the log files into the database. If I use the copy following syntax in shell script it works, but I need to use it in Perl. In shell script look like this and it

Re: [SQL] copy tables

2005-10-14 Thread Dau Sy Manh
vendredi 14 octobre 2005 13:55To: pgsql-sql@postgresql.orgSubject: [SQL] copy tables  HelloI have 2 postgreSQL databases called "DATA1" and "DATA2" with several tables inside them (table A, B, C). I modify the details in table "A" in database "DATA1&qu

Re: [SQL] copy table

2005-10-14 Thread Muralidharan Ramakrishnan
INSERT INTO MYSCHEMA2.TABLENAME SELECT * FROM MYSCHEMA1.TABLENAME WHERE < CONDITION >Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: Hello   How can i copy a table from one schema to another..   Example..   * I have a database "mydatabase" * then i have 2 schemas "myschema1" and "

Re: [SQL] copy table

2005-10-14 Thread A. Kretschmer
am 14.10.2005, um 10:44:13 +0200 mailte Shavonne Marietta Wijesinghe folgendes: > Hello > > How can i copy a table from one schema to another.. create table as select * from table > > Example.. Yeah! test=# create schema foo; CREATE SCHEMA test=# create schema bar; CREATE SCHEMA test=# creat

[SQL] copy table

2005-10-14 Thread Shavonne Marietta Wijesinghe
Hello   How can i copy a table from one schema to another..   Example..   * I have a database "mydatabase" * then i have 2 schemas "myschema1" and "myschema2" * in "myschema1" i have inserted a new line and i want to copy that to "myschema2" so they both will be same..   How can i do it with

Re: [SQL] copy tables

2005-10-14 Thread A. Kretschmer
am 14.10.2005, um 8:54:39 +0200 mailte Shavonne Marietta Wijesinghe folgendes: > Hello > > I have 2 postgreSQL databases called "DATA1" and "DATA2" with several tables > inside them (table A, B, C). > > I modify the details in table "A" in database "DATA1" > > How can I copy table "A" from

[SQL] copy tables

2005-10-13 Thread Shavonne Marietta Wijesinghe
 HelloI have 2 postgreSQL databases called "DATA1" and "DATA2" with several tables inside them (table A, B, C). I modify the details in table "A" in database "DATA1" How can I copy table "A" from database "DATA1" and paste it in database "DATA2" using the same table name ??Thank you.  

Re: [SQL] Copy Views From Database?

2005-09-22 Thread Hannes Dorbath
On 22.09.2005 11:47, [EMAIL PROTECTED] wrote: How would you use it to only dump / restore the views? I don't want any database tables. Please RTFM. But because I'm such a nice guy: Create a binary dump of the schema: pg_dump -v -s -i -F c -Z 9 -U -f /tmp/dump.bin Use the -l option of pg_re

Re: [SQL] Copy Views From Database?

2005-09-22 Thread Hannes Dorbath
On 22.09.2005 10:37, [EMAIL PROTECTED] wrote: Is there a maybe a tool that I can use to copy views as-is from one database into another? pg_dump and pg_restore :) ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [SQL] Copy Views From Database?

2005-09-22 Thread Hannes Dorbath
use pg_dump and pg_restore :) On 22.09.2005 10:37, [EMAIL PROTECTED] wrote: Hi Guys, I'm using PostGreSQL with a Java project since I'm a proffesional Java developer. I've a database that have about 120 views in PostGreSQL 7.0 that I need to copy into PostGreSQL 8.0. I can copy them one-by-one

[SQL] Copy Views From Database?

2005-09-22 Thread [EMAIL PROTECTED]
Hi Guys, I'm using PostGreSQL with a Java project since I'm a proffesional Java developer. I've a database that have about 120 views in PostGreSQL 7.0 that I need to copy into PostGreSQL 8.0. I can copy them one-by-one in pgAdmin but I don't have the time! Is there a maybe a tool that I can use t

Re: [SQL] Copy user privileges

2005-07-13 Thread Graham Vickrage
about the internals to attempt it. Thanks again, Graham -Original Message- From: Michael Fuhr [mailto:[EMAIL PROTECTED] Sent: 12 July 2005 20:29 To: Tom Lane Cc: Graham Vickrage; pgsql-sql@postgresql.org Subject: Re: [SQL] Copy user privileges On Tue, Jul 12, 2005 at 03:12:50PM -0400, Tom

Re: [SQL] Copy user privileges

2005-07-12 Thread Michael Fuhr
On Tue, Jul 12, 2005 at 03:12:50PM -0400, Tom Lane wrote: > "Graham Vickrage" <[EMAIL PROTECTED]> writes: > > I want to keep all the privileges but assign them to a new user. > > > What is the best way of doing this? > > How about just renaming the old user to a new name? > > I don't think we h

Re: [SQL] Copy user privileges

2005-07-12 Thread Tom Lane
"Graham Vickrage" <[EMAIL PROTECTED]> writes: > I want to keep all the privileges but assign them to a new user. > What is the best way of doing this? How about just renaming the old user to a new name? I don't think we have an ALTER command for that, but an UPDATE on pg_shadow would get the jo

[SQL] Copy user privileges

2005-07-12 Thread Graham Vickrage
Hi All, I have dumped a database with no data and restored it with a new db name. I want to keep all the privileges but assign them to a new user. What is the best way of doing this? Is it to alter the system tables directly in which case which ones. TIA, Graham ---(

Re: [SQL] copy rows

2005-02-14 Thread Christoph Haller
I have not been too deep into 8.0, but AFAIK from the 7.x releases, the only way to do things like you describe, is do it the hard way: use SELECT INTO to get the field values you want into variables modify the necessary field values do the INSERT via Executing A Dynamic Command Inserting a re

[SQL] copy rows

2005-02-09 Thread drdani
Hi, What is the simplest solution in plpgsql to copy some rows in a table? I would like to do something like: select some rows do for each row skip serial field \ modify one field |-- what is the simplest way for this? insert as new row / Is it possible to insert a record t

Re: [SQL] "copy from" in "create function"

2004-10-25 Thread Jan Wieck
On 10/20/2004 6:03 PM, Gifford Hesketh wrote: Am I forgetting some limitation ? I get "ERROR: syntax error at or near "$1" at character 22" with this: CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS ' COPY b_import FROM $1 ; ' LANGUAGE 'sql' STABLE; Utility statements don't accept par

[SQL] "copy from" in "create function"

2004-10-25 Thread Gifford Hesketh
Am I forgetting some limitation ? I get "ERROR: syntax error at or near "$1" at character 22" with this: CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS ' COPY b_import FROM $1 ; ' LANGUAGE 'sql' STABLE; ---(end of broadcast)--- TIP 4:

Re: [SQL] copy old column's values to new column

2004-09-02 Thread Bruno Wolff III
On Thu, Sep 02, 2004 at 06:16:47 -0700, [EMAIL PROTECTED] wrote: > Hello, > > I need some basic SQL help. I added a new column to an existing table, > and now I need to copy values from one of the old columns to this new > columns. > > I need something like this: > > FOR pvId IN SELECT id FRO

[SQL] copy old column's values to new column

2004-09-02 Thread ogjunk-pgjedan
Hello, I need some basic SQL help. I added a new column to an existing table, and now I need to copy values from one of the old columns to this new columns. I need something like this: FOR pvId IN SELECT id FROM preference_value LOOP update preference_value SET display_value = (select v

Re: [SQL] Copy command freezes but INSERT works fine with trigger on insert.

2004-08-27 Thread Artimenko Igor
Copy from .. works fine for 1000 records to load. For data set of 6 records I could never get it finish. And I'm planing to reload 1000,000 records. So there is a limit somewhere between 1,000 & 60,000 since it starts working slower. The only question for me left is. What config parameter(s)

Re: [SQL] Copy command freezes but INSERT works fine with trigger oninsert.

2004-08-27 Thread Gregory S. Williamson
Igor [mailto:[EMAIL PROTECTED] Sent: Fri 8/27/2004 1:16 PM To: [EMAIL PROTECTED] Cc: Subject:[SQL] Copy command freezes but INSERT works fine with trigger oninsert. I tried to add up records 2 different ways: 1. using command [copy messageinfo (user_id, receivedtime,

[SQL] Copy command freezes but INSERT works fine with trigger on insert.

2004-08-27 Thread Artimenko Igor
I tried to add up records 2 different ways: 1. using command [copy messageinfo (user_id, receivedtime, filename, sendersstring, subject, hasattachments, groupmsg, msgsize, version ) FROM '/meridtemp/messageinfo.dat';] from psql 2. using simple INSERT INTO messageinfo ( user_id ) V

Re: [SQL] COPY command

2004-01-08 Thread Michael Glaesemann
On Jan 9, 2004, at 1:11 PM, [EMAIL PROTECTED] wrote: how do we run the COPY command from file which has several null columns in each field.   thanks. example :    dwnc=# copy biosadm.custinv_temp dwnc-# from '/home/bios/customer_data/CustomerInvoice_5Dec03_tab.txt' ; ERROR:  copy: line 1, Missing

Re: [SQL] COPY command

2004-01-08 Thread azwa
ST Yesterday         To:        <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>         cc:                 Subject:        RE: [SQL] COPY command This sounds as if the last character in each line might be a delimiter (a ",") which is standard for data unloaded from some sources; if

Re: [SQL] COPY command

2004-01-08 Thread Gregory S. Williamson
he line in question ? HTH, Greg Williamson DBA GlobeXplorer LLC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tue 1/6/2004 10:19 PM To: [EMAIL PROTECTED] Cc: Subject: [SQL] COPY command Hi, i try to load a file into temporary table but i

[SQL] COPY command

2004-01-08 Thread azwa
Hi, i try to load a file into temporary table but it gives me an error . do u have any idea/solutions ?? the command that i've running as below : dwnc=# copy biosadm.custdo_temp dwnc-# from '/home/bios/customer_data/CustomerDO_new.CSV' dwnc-# WITH DELIMITER ',' ; ERROR: copy: line 14

[SQL] COPY command

2004-01-08 Thread azwa
Hi,   i try to load a file into temporary table but it gives me an error . do u have any idea/solutions ??  the command that i've running as below :     dwnc=# copy biosadm.custdo_temp dwnc-# from '/home/bios/customer_data/CustomerDO_new.CSV' dwnc-# WITH DELIMITER ',' ; ERROR:  copy: line 1

[SQL] COPY

2003-11-17 Thread ritchie turner
Hi all I'm trying to optimise some sql inserts I have by using the COPY command instead. I'm connecting from Java using 7.4 beta 3. It works at the command line, but I can't get it to work from Java. Here's the pg log output. LOG: query: COPY bingo_cards (account_id, game_id, win_ball, card,

Re: [SQL] Copy Command Error

2003-09-15 Thread Richard Huxton
On Monday 15 September 2003 09:57, Richard Sydney-Smith wrote: > I am outputting the following rows from a SYBASE database on W2000 > The problem is that each string is imported with the inverted commas. > > eg field ID = ''RK'' instead of 'RK' > > Can someone please help? A short bit of perl. So

[SQL] Copy Command Error

2003-09-15 Thread Richard Sydney-Smith
I am outputting the following rows from a SYBASE database on W2000   3 '2' 'IBISFinancials' 'A.C.N. 072 378 815'8 'RK' 'Personal Accounts'    Using the command:   select cast(seq as integer) , id , cmpy, tr_n from fcont; output to d:\fcont.dat format 'ascii' delimited by '\x09'   This output

Re: [SQL] Copy from a SELECT

2003-02-27 Thread Valerie Goodman
copy that table out . -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Christoph Haller Sent: 27 February 2003 12:45 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Copy from a SELECT > > I know that the COPY command requires that you work with pl

[SQL] Copy from a SELECT

2003-02-26 Thread val
I know that the COPY command requires that you work with plain tables. Is there any other way at all of export only part of a table ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] COPY use in function with variable file name

2003-02-02 Thread Oliver Elphick
On Wed, 2003-01-29 at 08:05, Sondaar Roelof wrote: > Hello, > > I can't figure out how to make this work, or is not possible? > > In a function i would like to read a file. > The file name is determined by a value from a table. > However the COPY statement does not to accept this? > I tried vario

[SQL] COPY use in function with variable file name

2003-02-01 Thread Sondaar Roelof
Hello, I can't figure out how to make this work, or is not possible? In a function i would like to read a file. The file name is determined by a value from a table. However the COPY statement does not to accept this? I tried various forms of adding (single)-quotes but no luck. Anyone any ideas?

Re: [SQL] COPY fails but INSERT works

2002-12-28 Thread Gary Stainburn
On Saturday 28 December 2002 3:48 pm, Stephan Szabo wrote: > On Sat, 28 Dec 2002, Gary Stainburn wrote: > > When I create the database, I use the COPY command. The ranks and > > jobtypes are populated okay but the abilities table is empty. However, > > if I then INSERT the data the inserts work f

  1   2   >