Re: [GENERAL] query rewrite rules for updateable views?

2006-09-25 Thread Markus Grabner
Am Montag, 25. September 2006 07:09 schrieb A. Kretschmer: am Mon, dem 25.09.2006, um 2:56:47 +0200 mailte Markus Grabner folgendes: Hi! As far as I understand, one can simulate updateable views in PostgreSQL by providing appropriate query rewrite rules. Is there any tool to

Re: [GENERAL] IF EXISTS

2006-09-25 Thread Dawid Kuroczko
On 9/21/06, stevethames [EMAIL PROTECTED] wrote: Ok, thanks, Jeff. This is not a critical problem. Just annoying. I'll wait for 8.2. BTW, while I can see the reason for adding the IF EXISTS clause to the language for checking the existence of objects, wouldn't it be easier to simply provide

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Gurjeet Singh
I too have been bothered about this behaviour in the past.On 9/25/06, Michael Fuhr [EMAIL PROTECTED] wrote: Transactions are all-or-nothing: all statements must succeed or theCorrect. All other databases I used up to now just ignore the statement violating the constraint, but leave the

Re: [GENERAL] Replication and PITR

2006-09-25 Thread Bo Lorentsen
Jeff Davis wrote: 8.2 will fix this. You can send the WALs periodically even if they're not full. In general, PITR will be substantially improved in 8.2 (thanks Simon!). This sounds very nice, and this will make PG an even more reliable tool. The beta should be out soon enough. Download it

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Karsten Hilbert
On Mon, Sep 25, 2006 at 03:16:07PM +0530, Gurjeet Singh wrote: All other databases I used up to now just ignore the statement violating the constraint, but leave the transaction intact. Which databases behave that way? Does COMMIT succeed even if some statements failed? Oracle, for

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Alban Hertroys
Gurjeet Singh wrote: All other databases I used up to now just ignore the statement violating the constraint, but leave the transaction intact. Which databases behave that way? Does COMMIT succeed even if some statements failed? Oracle, for one, behaves that way...

Re: [GENERAL] Replication and PITR

2006-09-25 Thread Bo Lorentsen
Jeff Davis wrote: Standby mode means that the database is kept almost up to date with the master, but is not up. When the master goes down, you can bring the standby machine up. Until then, you unfortunately can't even do read queries on that machine. Do you know if this will change in the

Re: [GENERAL] copy db1 to db2

2006-09-25 Thread Matthias . Pitzl
What kind of errors? Just saying i got some errors isn't very helpfull for us to be able to help you properly ;) So, what exact error messages you get when trying to restore the database? -- Matthias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Gurjeet Singh
On 9/25/06, Alban Hertroys [EMAIL PROTECTED] wrote: In this casePostgreSQL does the right thing; something went wrong, queries after theerror may very well depend on that data - you can't rely on the currentstate. And it's what the SQL specs say too, of course... [1] I'm not trying to imply that

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Karsten Hilbert
On Mon, Sep 25, 2006 at 05:40:56PM +0530, Gurjeet Singh wrote: In this case PostgreSQL does the right thing; something went wrong, queries after the error may very well depend on that data - you can't rely on the current state. And it's what the SQL specs say too, of course... In an

Re: [GENERAL] copy db1 to db2

2006-09-25 Thread Bill Moran
In response to Bobby Gontarski [EMAIL PROTECTED]: Basically I need to copy db1 to db2 which I create manually. How do I do that, I tried pg_dump pg_restore but I get some errors with foreign key restraint... You can use create database with db1 as the template. See the docs for details. --

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Scott Marlowe
On Sun, 2006-09-24 at 12:03 +0200, Ralf Wiebicke wrote: Hi all! I just realized the following behaviour in postgresql: when I violate any constraint (unique constraint in my case) then the transaction is not usable anymore. Any other sql command returns a in failed sql transaction error.

Re: [GENERAL] serial column

2006-09-25 Thread Brandon Aiken
I would tend to agree with Tom. A table is by definition an unordered set of records. Forcing keys to have meaning of this type implies that there is a relationship between each record in the set. That's information you should be storing as part of the record. If order is important, design the

[GENERAL] Timestamp with timezone query

2006-09-25 Thread Harry Hehl
Hello, I have a table with TIMESTAMP WITH TIMEZONE column. I would like to query for a timestamp using a different timezone. For example if a column contains '2006-02-11 00:30:00-05' select * from table where column='2006-02-10 19:30:00+00' would return the column containing '2006-02-11

Re: [GENERAL] Timestamp with timezone query

2006-09-25 Thread Brandon Aiken
Use the AT TIME ZONE construct: http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html#F UNCTIONS-DATETIME-ZONECONVERT -- Brandon Aiken CS/IT Systems Engineer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harry Hehl Sent: Monday,

Re: [GENERAL] serial column

2006-09-25 Thread Bob Pawley
Actually, I am not trying to force keys nor, I don't beleive, am I trying to force an hierarchal structure within the database. The numbers I want to assign to devices are nothing more than merely another attribute of the device - perhaps akin to a number in a street address. The problem,

Re: [GENERAL] serial column

2006-09-25 Thread Jeff Davis
On Mon, 2006-09-25 at 00:19 +0200, Gevik Babakhani wrote: On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: It's the behavior I expect - but the gaps aren't acceptable. Bob Then using the SERIAL or SEQUENCE won't do you any good. A possible solution for this would be to regenerate

Re: [GENERAL] Replication and PITR

2006-09-25 Thread Jeff Davis
On Mon, 2006-09-25 at 13:48 +0200, Bo Lorentsen wrote: Jeff Davis wrote: Standby mode means that the database is kept almost up to date with the master, but is not up. When the master goes down, you can bring the standby machine up. Until then, you unfortunately can't even do read queries

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Andrew Sullivan
On Mon, Sep 25, 2006 at 05:40:56PM +0530, Gurjeet Singh wrote: I sure like PG's following of the standards, but usability should not be lost sight of. One man's meal is another man's poison. For me, with a small number of exceptions, the standards conformance _is_ what makes PostgreSQL so

[GENERAL] pl/perl autonomous transactions question

2006-09-25 Thread Bob
I would like to use autonomous transactions for a large batch process and I want this all encapsulated within stored procedures. I want to commit after say every 15,000 records. The only way I have found to do this is to use the perl DBI in my stored procedure to establish a new connection to the

Re: [GENERAL] What is the Best Postgresql Load Balancing Solution available ?

2006-09-25 Thread Nikolay Samokhvalov
As for persistent connection with PHP, start from here: http://php.net/pg_pconnect. Also, I recommend to ensure that you have proper set of indexes on your tables and your system doesn't use badly written queries (such as join of several dozens of tables :-) ). There is an excellent tool that

[GENERAL] getting dates in the past

2006-09-25 Thread garry saddington
How could I translate this into sql? select result from results where date_entered between (last september and the one before that) Its the part in brackets that has me guessing. I am still experimenting but any help will be gratefully recieved. Kind Regards Garry

Re: [GENERAL] What is the Best Postgresql Load Balancing Solution

2006-09-25 Thread Joshua D. Drake
Nikolay Samokhvalov wrote: As for persistent connection with PHP, start from here: http://php.net/pg_pconnect. Uhmmm no. Start here: http://pgpool.projects.postgresql.org/ pg_pconnect tends to have a host of issues. Joshua D. Drake Also, I recommend to ensure that you have proper set of

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Ralf Wiebicke
Hi! Thanks for all the help. I finally used savepoints to get what I want. However I don't like this very much. I tried a few other databases (hsqldb, mysql/innodb and oracle), and none of them made the transaction unusable after violating the constraint. Best regards, Ralf.

Re: [GENERAL] Timestamp with timezone query

2006-09-25 Thread Harry Hehl
Thanks, that does it. select * from table where column = '2006-02-10 19:30:00' AT TIME ZONE 'utc'; I also have a TIME WITH TIMEZONE column that I have to do the same thing with but AT TIME ZONE can't be used directly. I tried several approaches but I either get incorrect results or syntax

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Scott Marlowe
On Mon, 2006-09-25 at 16:20, Ralf Wiebicke wrote: Hi! Thanks for all the help. I finally used savepoints to get what I want. However I don't like this very much. I tried a few other databases (hsqldb, mysql/innodb and oracle), and none of them made the transaction unusable after

Re: [GENERAL] Restart after poweroutage

2006-09-25 Thread Tom Lane
Adrian Klaver [EMAIL PROTECTED] writes: On Sunday 24 September 2006 09:17 am, Tom Lane wrote: Jon Lapham [EMAIL PROTECTED] writes: FATAL: pre-existing shared memory block (key 5432001, ID 65536) is still in use This is extremely odd, because a shared memory block could not possibly have

Re: [GENERAL] in failed sql transaction

2006-09-25 Thread Tom Lane
Ralf Wiebicke [EMAIL PROTECTED] writes: I finally used savepoints to get what I want. However I don't like this very much. Have you experimented with psql's ON_ERROR_ROLLBACK setting? regards, tom lane ---(end of

Re: [GENERAL] Timestamp with timezone query

2006-09-25 Thread Brandon Aiken
Hm? Works for me: postgres=# select time with time zone '00:30:00-05' at time zone 'utc'; timezone - 05:30:00+00 (1 row) What are you trying to do with the query? -- Brandon Aiken CS/IT Systems Engineer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

[GENERAL] function for longest common substring?

2006-09-25 Thread Ben
Does anybody have a stored proc they'd like to share that computes the longest common substring for a set of strings? Wikipedia defines the problem nicely: http://en.wikipedia.org/wiki/Longest_common_substring_problem Basically, given abcba and abdba, the algorithm should return ab and ba as

Re: [GENERAL] getting dates in the past

2006-09-25 Thread Michael Glaesemann
On Sep 26, 2006, at 5:59 , garry saddington wrote: How could I translate this into sql? select result from results where date_entered between (last september and the one before that) Its the part in brackets that has me guessing. I am still experimenting but any help will be gratefully

[GENERAL] deadlock avoidance

2006-09-25 Thread Clarence Gardner
I noticed the following in some of our code today: select ... join list ... for update of a, b; Inasmuch as the cardinal rule for avoiding deadlocks is to acquire locks in a consistent order, should such a construction be avoided in favor of two separate select ... for update statements so

Re: [GENERAL] deadlock avoidance

2006-09-25 Thread Tom Lane
Clarence Gardner [EMAIL PROTECTED] writes: I noticed the following in some of our code today: select ... join list ... for update of a, b; Inasmuch as the cardinal rule for avoiding deadlocks is to acquire locks in a consistent order, should such a construction be avoided in favor of two

Re: [GENERAL] Restart after poweroutage

2006-09-25 Thread Adrian Klaver
On Monday 25 September 2006 02:48 pm, Tom Lane wrote: Adrian Klaver [EMAIL PROTECTED] writes: On Sunday 24 September 2006 09:17 am, Tom Lane wrote: Jon Lapham [EMAIL PROTECTED] writes: FATAL: pre-existing shared memory block (key 5432001, ID 65536) is still in use This is extremely

Re: [GENERAL] Restart after poweroutage

2006-09-25 Thread Tom Lane
Adrian Klaver [EMAIL PROTECTED] writes: On Monday 25 September 2006 02:48 pm, Tom Lane wrote: I spent quite some time today trying to duplicate this failure (by pulling the plug on an up-to-date Fedora Core 5 machine). No luck. Is there something I could do to help capture useful information

Re: [GENERAL] Restart after poweroutage

2006-09-25 Thread Tom Lane
I wrote: Also, if it is repeatable, ipcs -m output will be useful context. I forgot to mention: on Linux it's important to run ipcs as root (eg sudo ipcs -m) else it will lie to you. An incomplete listing is worse than useless. regards, tom lane

Re: [GENERAL] Timestamp with timezone query

2006-09-25 Thread Brandon Aiken
Title: RE: [GENERAL] Timestamp with timezone query I'm not at my dev station to check, but what about: SELECT myTime AT TIME ZONE 'UTC' FROM theTable; Then try: SELECT myTime AT TIME ZONE 'UTC' FROM theTable WHERE myTime = '19:30:00-00'; Or: SELECT myTime AT TIME ZONE 'UTC' FROM theTable

Re: [GENERAL] query rewrite rules for updateable views?

2006-09-25 Thread Jaime Casanova
On 9/25/06, Markus Grabner [EMAIL PROTECTED] wrote: Am Montag, 25. September 2006 07:09 schrieb A. Kretschmer: am Mon, dem 25.09.2006, um 2:56:47 +0200 mailte Markus Grabner folgendes: Hi! As far as I understand, one can simulate updateable views in PostgreSQL by providing