[GENERAL] Combine psql command with shell script

2009-03-11 Thread John Wang
How to combine psql commands, such as \copy, with shell script? Is there any sample code? For example, I have 10 tables and want to user the \copy command to import data from 10 different text files. I can execute the \copy command 10 times. But it is not convenient. Thanks. --

Re: [GENERAL] Combine psql command with shell script

2009-03-11 Thread John R Pierce
John Wang wrote: How to combine psql commands, such as \copy, with shell script? Is there any sample code? For example, I have 10 tables and want to user the \copy command to import data from 10 different text files. I can execute the \copy command 10 times. But it is not convenient. $

Re: [GENERAL] Combine psql command with shell script

2009-03-11 Thread A. Kretschmer
In response to John Wang : How to combine psql commands, such as \copy, with shell script? Is there any sample code? For example, I have 10 tables and want to user the \copy command to import data from 10 different text files. I can execute the \copy command 10 times. But it is not

Re: [GENERAL] tsearch2 dictionary for statute cites

2009-03-11 Thread Oleg Bartunov
On Tue, 10 Mar 2009, Tom Lane wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: People are likely to search for statute cites, which tend to have a hierarchical form. I'm not sure the prefix approach will work for this. For example, there is a section 939.64 in the state statutes

Re: [GENERAL] upgrade from 7.4 to 8.3

2009-03-11 Thread Marc Cuypers
Thanks Tom, Tom Lane schreef: Marc Cuypers m.cuyp...@mgvd.be writes: Databases in 7.4 were encoded as utf-8. Now when importing postgresql gives the following error: ERROR: encoding UTF8 does not match server's locale en_US DETAIL: The server's LC_CTYPE setting requires encoding LATIN1.

Re: [GENERAL] upgrade from 7.4 to 8.3

2009-03-11 Thread Schwaighofer Clemens
On Wed, Mar 11, 2009 at 19:01, Marc Cuypers m.cuyp...@mgvd.be wrote: Thanks Tom, Only... One database was in LATIN9.  When creating this database i got the same error. Command: CREATE DATABASE hardsoft WITH OWNER = postgres TEMPLATE = template0 ENCODING = 'LATIN9'; Error: ERROR:

Re: [GENERAL] upgrade from 7.4 to 8.3

2009-03-11 Thread Gregory Stark
Marc Cuypers m.cuyp...@mgvd.be writes: Error: ERROR: encoding LATIN9 does not match server's locale nl_BE.utf8 SQL state: XX000 Detail: The server's LC_CTYPE setting requires encoding UTF8. Can i only use nl_BE and UTF-8 now? Why can't i use LATIN9 anymore? Is bacula 8.3 stricter in this

Re: [GENERAL] Combine psql command with shell script

2009-03-11 Thread Alvaro Herrera
John Wang wrote: How to combine psql commands, such as \copy, with shell script? Is there any sample code? For example, I have 10 tables and want to user the \copy command to import data from 10 different text files. I can execute the \copy command 10 times. But it is not convenient. If the

Re: [GENERAL] SOLVED upgrade from 7.4 to 8.3

2009-03-11 Thread Marc Cuypers
Thanks Clemens, Schwaighofer Clemens schreef: On Wed, Mar 11, 2009 at 19:01, Marc Cuypers m.cuyp...@mgvd.be wrote: Thanks Tom, Only... One database was in LATIN9. When creating this database i got the same error. Command: CREATE DATABASE hardsoft WITH OWNER = postgres TEMPLATE =

Re: [GENERAL] upgrade from 7.4 to 8.3

2009-03-11 Thread Marc Cuypers
Gregory Stark schreef: Marc Cuypers m.cuyp...@mgvd.be writes: Error: ERROR: encoding LATIN9 does not match server's locale nl_BE.utf8 SQL state: XX000 Detail: The server's LC_CTYPE setting requires encoding UTF8. Can i only use nl_BE and UTF-8 now? Why can't i use LATIN9 anymore? Is bacula

Re: [GENERAL] upgrade from 7.4 to 8.3

2009-03-11 Thread Tom Lane
Marc Cuypers m.cuyp...@mgvd.be writes: Can i only use nl_BE and UTF-8 now? Why can't i use LATIN9 anymore? The server-side encoding has to be compatible with the locale. (7.4 didn't really *work* in this situation, as I'm surprised you failed to notice.) What you can do is keep the database

Re: [GENERAL] ERROR: table row type and query-specified row type do not match

2009-03-11 Thread Merlin Moncure
On Wed, Mar 11, 2009 at 12:11 AM, Joseph S j...@selectacast.net wrote: After adding a date column to a table, I started getting these errors from my triggers: ERROR:  table row type and query-specified row type do not match DETAIL:  Query has too few columns. The triggers just did simple

Re: [GENERAL] C++ User-defined functions

2009-03-11 Thread George Oakman
Hi, Thank you Craig and Magnus for your answers. I have tried compiling with Visual Studio 2005 and I'm still getting those errors: c:\program files\postgresql\8.3\include\server\pg_config_os.h(188) : error C2011: 'timezone' : 'struct' type redefinition c:\program

Re: [GENERAL] tsearch2 dictionary for statute cites

2009-03-11 Thread Kevin Grittner
Oleg Bartunov o...@sai.msu.su wrote: On Tue, 10 Mar 2009, Tom Lane wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: People are likely to search for statute cites, which tend to have a hierarchical form. I'm not sure the prefix approach will work for this. For example, there is a

[GENERAL] Suggestions for blocking user inserts during admin bulk loading.

2009-03-11 Thread Woody Woodring
I have a table that users can update if the data is old. Once a day I update every entry in the table. However I get primary key violations occasionally which it seems a user inserted into the table while the bulk insert is going on. The following is the procedure I use for updating the entire

Re: [GENERAL] Suggestions for blocking user inserts during admin bulk loading.

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 8:01 AM, Woody Woodring george.woodr...@iglass.net wrote: I have a table that users can update if the data is old.  Once a day I update every entry in the table.  However I get primary key violations occasionally which it seems a user inserted into the table while the

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Joshua D. Drake
On Tue, 2009-03-10 at 18:54 -0700, Glen Parker wrote: I am wondering the feasibility of having PG continue to work even if non-essential indexes are gone or corrupt. I brought this basic concept up at some point in the past, but now I have a different motivation, so I want to strike up

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Grzegorz Jaśkiewicz
On Wed, Mar 11, 2009 at 3:03 PM, Joshua D. Drake j...@commandprompt.com wrote: Any chance of something like this being done in the future? I am going to go out on a limb here and say, no. That would probably be possible, by placing all indicies in a separate directory in data, but Well,

[GENERAL] Server Shutting Down

2009-03-11 Thread Bob Pawley
Hi I've had the server shut itself down when attempting to connect, even with PG Admin. Is there anything I can do to ensure that the pg server continues to run during a connection? Bob -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Steve Crawford
Bob Pawley wrote: Hi I've had the server shut itself down when attempting to connect, even with PG Admin. Is there anything I can do to ensure that the pg server continues to run during a connection? Bob We're going to need a bit more to go on. Is it the whole server or just your

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Adrian Klaver
- Bob Pawley rjpaw...@shaw.ca wrote: Hi I've had the server shut itself down when attempting to connect, even with PG Admin. Is there anything I can do to ensure that the pg server continues to run during a connection? Bob We are going to need a bit more information. What

Re: [GENERAL] mdf

2009-03-11 Thread Steve Crawford
John R Pierce wrote: ... Access natively uses JET databases, which are .MDB not .MDF ... MDF? MDB? All looks the same late on Friday when you mind is shifting gears to the pint of Guinness waiting for you after work. :) Cheers, Steve -- Sent via pgsql-general mailing list

Re: [GENERAL] Suggestions for blocking user inserts during admin bulk loading.

2009-03-11 Thread Tom Lane
Woody Woodring george.woodr...@iglass.net writes: The following is the procedure I use for updating the entire table, mac is the primary key: truncate master; create temp_table; COPY temp_table (mac, . . .) FROM stdin WITH DELIMITER AS '|'; UPDATE master SET mac=temp_table.mac . . . FROM

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Bob Pawley
Other than shutting down unexpectedly the server works fine. I now have the server running as a remote host on my computer. I have been running it on localhost. It was shutting down when I was attempting to connect with my application. I didn't think too much about it figuring I would find

[GENERAL] Question about \copy

2009-03-11 Thread John Wang
I have a table, for example, Product. It's index is Product_index. If I use \copy to load data into the table: \copy Product from data.txt Will the index, Product_index, also be updated with the new data during copy? Thanks. -- Sent via pgsql-general mailing list

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Adrian Klaver
- Bob Pawley rjpaw...@shaw.ca wrote: Other than shutting down unexpectedly the server works fine. I now have the server running as a remote host on my computer. I have been running it on localhost. It was shutting down when I was attempting to connect with my application. I

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 11:13 AM, Bob Pawley rjpaw...@shaw.ca wrote: Other than shutting down unexpectedly the server works fine. Wait, do you mean the postgresql service, or the whole server (OS and all) shuts down? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] Question about \copy

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 11:21 AM, John Wang johnw822...@yahoo.com wrote: I have a table, for example, Product. It's index is Product_index. If I use \copy to load data into the table: \copy Product from data.txt Will the index, Product_index, also be updated with the new data during

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Bob Pawley
What log should I get and how do I get it?? Bob - Original Message - From: Adrian Klaver akla...@comcast.net To: Bob Pawley rjpaw...@shaw.ca Cc: PostgreSQL pgsql-general@postgresql.org; Steve Crawford scrawf...@pinpointresearch.com Sent: Wednesday, March 11, 2009 10:21 AM Subject:

Re: [GENERAL] Question about \copy

2009-03-11 Thread F. Jovan Jester
On Mar 11, 2009, at 1:21 PM, John Wang wrote: I have a table, for example, Product. It's index is Product_index. If I use \copy to load data into the table: \copy Product from data.txt Will the index, Product_index, also be updated with the new data during copy? Yes, and indexes are

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Steve Crawford
The PostgreSQL Server log. I don't know about Windows but in *nix you need to edit the ERROR REPORTING AND LOGGING section of postgresql.conf, wherever that is located in your install (we still have no idea what OS, OS release/version, and PG version we are trying to help you with). If you

[GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread SHARMILA JOTHIRAJAH
Hi, I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can be synced just once a day). Is there a way to archive this using function ? Something like Select syncTable('foo') where syncTable is a function that compares table

Re: [GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 1:20 PM, SHARMILA JOTHIRAJAH sharmi...@yahoo.com wrote: Hi, I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can be synced just once a day). Is there a way to archive this using function ? Something

Re: [GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread SHARMILA JOTHIRAJAH
--- On Wed, 3/11/09, Scott Marlowe scott.marl...@gmail.com wrote: Hi, I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can be synced just once a day). Is there a way to archive this using function ? Something like

Re: [GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread SHARMILA JOTHIRAJAH
Hi, I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can be synced just once a day). Is there a way to archive this using function ? Something like Select syncTable('foo') where syncTable is a function that

Re: [GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 1:29 PM, SHARMILA JOTHIRAJAH sharmi...@yahoo.com wrote: Hi, I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can be synced just once a day). Is there a way to archive this using function ? Something

Re: [GENERAL] Server Shutting Down

2009-03-11 Thread Raymond O'Donnell
On 11/03/2009 18:47, Steve Crawford wrote: The PostgreSQL Server log. I don't know about Windows but in *nix you need to edit the ERROR REPORTING AND LOGGING section of postgresql.conf, wherever that is located in your install (we still have no idea what OS, OS release/version, and PG version

Re: [GENERAL] Enable user access from remote host

2009-03-11 Thread Piotre Ugrumov
On 11 Mar, 01:41, akla...@comcast.net (Adrian Klaver) wrote: On Tuesday 10 March 2009 4:36:36 pm Piotre Ugrumov wrote: On 9 Mar, 02:22, t...@sss.pgh.pa.us (Tom Lane) wrote: John R Pierce pie...@hogranch.com writes: Tom Lane wrote: A more accurate statement is that it's trustworthy

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Glen Parker
Grzegorz Jaśkiewicz wrote: On Wed, Mar 11, 2009 at 3:03 PM, Joshua D. Drake j...@commandprompt.com wrote: Any chance of something like this being done in the future? I am going to go out on a limb here and say, no. That would probably be possible, by placing all indicies in a separate

Re: [GENERAL] Enable user access from remote host

2009-03-11 Thread Adrian Klaver
On Wednesday 11 March 2009 1:29:18 pm Piotre Ugrumov wrote: On 11 Mar, 01:41, akla...@comcast.net (Adrian Klaver) wrote: On Tuesday 10 March 2009 4:36:36 pm Piotre Ugrumov wrote: On 9 Mar, 02:22, t...@sss.pgh.pa.us (Tom Lane) wrote: John R Pierce pie...@hogranch.com writes: Tom Lane

Re: [GENERAL] Sync 2 tables in 2 databases

2009-03-11 Thread Joshua Tolley
On Wed, Mar 11, 2009 at 12:26:35PM -0700, SHARMILA JOTHIRAJAH wrote: It is just 1 way synchronization... replication with slony sounds pretty good... ill try that out Thanks There are options other than Slony, each with their pros and cons. Some that come to mind include Bucardo[1],

[GENERAL] COPY and pg_ctl -m fast stop

2009-03-11 Thread Jeff Davis
If I open up a session and do: copy t from stdin; And then I let the psql session just sit there, not producing data, then I do a pg_ctl -m fast stop, then that backend doing the copy doesn't terminate. Is this expected behavior? I looked at the code, and it looks like it ignores an

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Joshua D. Drake
On Wed, 2009-03-11 at 14:25 -0700, Glen Parker wrote: Grzegorz Jaśkiewicz wrote: So like JD said, if you don't want to dump indicies - just use pg_dump... If pg_dump were an acceptable backup tool, we wouldn't need PITR, would we? We used pg_dump for years. There's a very good reason we

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 3:25 PM, Glen Parker glene...@nwlink.com wrote: Grzegorz Jaśkiewicz wrote: So like JD said, if you don't want to dump indicies - just use pg_dump... If pg_dump were an acceptable backup tool, we wouldn't need PITR, would we?  We used pg_dump for years.  There's a very

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Glen Parker
Scott Marlowe wrote: pg_dump is a perfectly acceptable backup tool, as is PITR. They have different ways of operating based on what you need. Trying to make PITR act more like pg_dump seems kind of silly to me. pg_dump is not acceptable to us because of the potential to lose many hours of

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Alvaro Herrera
Glen Parker escribió: That's two people now who have called the idea silly without even a hint of a supporting argument. Why would it be silly to improve the performance of a highly valuable tool set without compromising its utility? Am I missing something here? That's certainly

[GENERAL] Streaming PUG meeting: PostgreSQL Genetics!

2009-03-11 Thread Josh Berkus
All, There *may* be a streaming presentation of PostgreSQL, Unison-DB and Genetech in 1/2 hour: http://cubic.org/sfpug.html 6:15 or 6:30pm PST/PDT, March 11th Join us and see if it works! --Josh Berkus -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] Streaming PUG meeting: PostgreSQL Genetics!

2009-03-11 Thread Josh Berkus
c...@zip.com.au wrote: On Wed, Mar 11, 2009 at 05:41:55PM -0700, Josh Berkus wrote: All, There *may* be a streaming presentation of PostgreSQL, Unison-DB and Genetech in 1/2 hour: http://cubic.org/sfpug.html 6:15 or 6:30pm PST/PDT, March 11th Join us and see if it works! Will there be a

Re: [GENERAL] Streaming PUG meeting: PostgreSQL Genetics!

2009-03-11 Thread CaT
On Wed, Mar 11, 2009 at 05:41:55PM -0700, Josh Berkus wrote: All, There *may* be a streaming presentation of PostgreSQL, Unison-DB and Genetech in 1/2 hour: http://cubic.org/sfpug.html 6:15 or 6:30pm PST/PDT, March 11th Join us and see if it works! Will there be a saved version of this

Re: [GENERAL] Streaming PUG meeting: PostgreSQL Genetics!

2009-03-11 Thread Christophe
On Mar 11, 2009, at 5:51 PM, CaT wrote: Will there be a saved version of this available for later viewing? Don't make me choose between steak and beer and postgres. 8( Yes! I'll announce it here when it's available. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: FWIW I don't think this idea is silly at all. It's so not-silly, in fact, that we already have some access methods that do this if an index cannot be recovered (I think at least GiST does it). Well, there's a difference between rebuild the

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Joshua D. Drake
On Wed, 2009-03-11 at 16:57 -0700, Glen Parker wrote: Scott Marlowe wrote: That's two people now who have called the idea silly without even a hint of a supporting argument. Why would it be silly to improve the performance of a highly valuable tool set without compromising its utility?

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Glen Parker
Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com writes: FWIW I don't think this idea is silly at all. It's so not-silly, in fact, that we already have some access methods that do this if an index cannot be recovered (I think at least GiST does it). Well, there's a difference

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Glen Parker
Joshua D. Drake wrote: 1. You could put all your indexes into a table space, this would allow you to try different things with the indexes. Most of them are, but I still have to back them up in order to have a valid backup, because the PITR code would choke if any are missing. 2. Even

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Tom Lane
Glen Parker glene...@nwlink.com writes: Tom Lane wrote: ... AFAICS what Glen is proposing is to not WAL-log index changes, and with that any crash no matter how minor would have to invalidate indexes. Nooo...! This has nothing to do with WAL logging index changes. How so? In any

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Tom Lane
Glen Parker glene...@nwlink.com writes: We have yet to recover from a PG disaster. We back up every night, and never use the back ups for anything. To me, it seems perfectly reasonable to get a quicker back up every night, with the remote possibility of ever having to pay the price for

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Scott Marlowe
On Wed, Mar 11, 2009 at 5:57 PM, Glen Parker glene...@nwlink.com wrote: Scott Marlowe wrote: pg_dump is a perfectly acceptable backup tool, as is PITR.  They have different ways of operating based on what you need.  Trying to make PITR act more like pg_dump seems kind of silly to me.

Re: [GENERAL] I don't want to back up index files

2009-03-11 Thread Joshua D. Drake
On Wed, 2009-03-11 at 20:59 -0600, Scott Marlowe wrote: On Wed, Mar 11, 2009 at 5:57 PM, Glen Parker glene...@nwlink.com wrote: Scott Marlowe wrote: Suggesting that a person who's been managing PG in a commercial setting since version 6.4 should just use pg_dump as an alternative to PITR