Re: [GENERAL] How to avoid error with convert() function

2006-09-26 Thread zeljko
zeljko wrote: SELECT convert(myfield,'LATIN2','WIN1250') FROM tbl; ERROR: character 0x828e of encoding MULE_INTERNAL has no equivalent in WIN1250 I know I have few characters like this one in table with about 1.000.000 rows. How to avoid such error and show eg. ? instead of error , or

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Bo Lorentsen
Jeff Davis wrote: I don't know for sure, but I would guess not any time soon. A PITR standby works by operating in recovery mode while it's waiting for the WAL files to arrive. When you bring the database up, you're telling it there are no more files to wait for, and to finish recovering and

Re: [GENERAL] change the order of FROM selection to make query work

2006-09-26 Thread Brandon Aiken
I think you're doing different join types. SQLite is probably doing CROSS JOINs. PostgreSQL is probably doing at least one INNER JOIN. From http://www.sqlite.org/lang_select.html: If multiple tables names are separated by commas, then the query is against the cross join of the various tables.

Re: [GENERAL] Good books about PL/PGSQL programming?

2006-09-26 Thread Andrew Sullivan
On Thu, Sep 21, 2006 at 10:33:41AM +0200, [EMAIL PROTECTED] wrote: Are there any good and recommendable books about PL/PGSQL programming? I think the Douglas book is rather good for this. A -- Andrew Sullivan | [EMAIL PROTECTED] The year's penultimate month is not in truth a good way of

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Andrew Sullivan
On Fri, Sep 22, 2006 at 07:58:41AM +0200, Bo Lorentsen wrote: Interesting note ... do you know how fare PG would be from being able to be in read-only state when receiving PITR data ? Is it a complex problem or a simple one to solve ? I don't know that it's even possible. The PITR replica

Re: [GENERAL] in failed sql transaction

2006-09-26 Thread Ralf Wiebicke
Have you experimented with psql's ON_ERROR_ROLLBACK setting? Thanks for the hint. Seems to be exactly what I want. But is not yet available through JDBC, as far as I see: http://archives.postgresql.org/pgsql-jdbc/2006-07/msg00092.php I'm writing a java framework, so there is no way around

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Csaba Nagy
I would think that the data pages are written and consistent while in recovery mode, so maybe it's reasonable to do. However, I'm only speculating and anything like this would probably not be coming soon. I was thinking at one point about what problems could prevent the standby to allow read

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Martijn van Oosterhout
On Tue, Sep 26, 2006 at 11:00:56AM +0200, Csaba Nagy wrote: Of course there might be other problems too. Another thing would be that the read-only transaction still needs a snapshot, and whatever transaction ID it uses will have been used by the server also. I think the visibility issue may be

Re: [GENERAL] in failed sql transaction

2006-09-26 Thread Gurjeet Singh
Thanks a lot for the pointer This is exactly what I have been looking for.from_docsThe on_error_rollback-on mode works by issuing an implicit SAVEPOINT for you, just before each command that is in a transaction block, and rolls back to the savepoint on error.

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Jon Lapham
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 odd, because a shared memory block could not

[GENERAL] Deadlock when one process opens two separate connections?

2006-09-26 Thread Kaloyan Iliev
Hi, Yestarday in the software, which my company developes, there happens a deadlock. One process opens a transaction, SELECT FOR UPDATE some rows from a table and then calls another function. The second function didn't receive (by programmers mistake) database handler and opens its own

[GENERAL] Add serial in specific order?

2006-09-26 Thread Poul Jensen
I have ~25 columns in my database and need to order the rows by all columns to do queries like: SELECT a FROM table ORDER BY a, b, c, , z; I suspect it would be highly ineffective to order by all columns for every query! Hence I'd like to do the ordering only once and add a serial to the

Re: [GENERAL] Deadlock when one process opens two separate connections?

2006-09-26 Thread Florian Weimer
* Kaloyan Iliev: Probbly beacause both transactions started from one process? Yes, the deadlock detector isn't psychic. It can't know about lock ordering constraints which are external to PostgreSQL. -- Florian Weimer[EMAIL PROTECTED] BFK edv-consulting GmbH

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Harald Armin Massa
Jon,For what it is worth, I created a FC5 VMware installation and loaded mydatabase data into it.I simulated a bunch of power outages by telling VMware to power off the vm.Is this a good simulation of a poweroutage, or is there something inherently flawed about using a VM to testthis?It is

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Tom Lane
Jon Lapham [EMAIL PROTECTED] writes: To stress test, I turned off the power while actively processing db operations, such as: loading data into a database, create a new database, delete contents of a large table within a transaction. Anyway, in every case I could not reproduce the issue,

Re: [GENERAL] Add serial in specific order?

2006-09-26 Thread Michael Glaesemann
On Sep 26, 2006, at 21:22 , Poul Jensen wrote: I have ~25 columns in my database and need to order the rows by all columns to do queries like: SELECT a FROM table ORDER BY a, b, c, , z; I suspect it would be highly ineffective to order by all columns for every query! Hence I'd like

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Jon Lapham
Tom Lane wrote: Jon Lapham [EMAIL PROTECTED] writes: Is it important for you to know that at the time of the power outage, I *did* have 2 closed source kernel modules loaded, vmware's and NVidia's. (This is a development machine, not production...). Could one of these modules screwed up

Re: [GENERAL] Dead Lock problem with 8.1.3

2006-09-26 Thread Kai Hessing
No one any idea? *sigh* Kai Hessing wrote: Hi Folks, I have a strange Problem (to be honest there are more than one, but this is one of it) after Upgrading to Postgres 8.1.3. The following SQL seems to produce a deadlock while doing an endless reading of a temp table: SELECT s.sid FROM

Re: [GENERAL] Dead Lock problem with 8.1.3

2006-09-26 Thread Joe Conway
Martijn van Oosterhout wrote: On Tue, Sep 26, 2006 at 03:59:48PM +0200, Kai Hessing wrote: No one any idea? *sigh* It probably has something to with the fact that you didn't explain what you meant by deadlock. Also, you refer to a temp table, yet don't indicate which table it is. You'll

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Jon Lapham
Harald Armin Massa wrote: It is inherently flawed. VMware really powers down, that is, the operating system has time to shut down. Or, in other incarnations, VMware freezes the system state. It's nothing near a real power outage, which gives no time for anything. On my VMware window, there

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Tom Lane
Jon Lapham [EMAIL PROTECTED] writes: Is it important for you to know that at the time of the power outage, I *did* have 2 closed source kernel modules loaded, vmware's and NVidia's. (This is a development machine, not production...). Could one of these modules screwed up somehow and

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread Jon Lapham
Tom Lane wrote: Jon Lapham [EMAIL PROTECTED] writes: To stress test, I turned off the power while actively processing db operations, such as: loading data into a database, create a new database, delete contents of a large table within a transaction. Anyway, in every case I could not reproduce

Re: [GENERAL] Dead Lock problem with 8.1.3

2006-09-26 Thread Martijn van Oosterhout
On Tue, Sep 26, 2006 at 03:59:48PM +0200, Kai Hessing wrote: No one any idea? *sigh* It probably has something to with the fact that you didn't explain what you meant by deadlock. Also, you refer to a temp table, yet don't indicate which table it is. You'll need to be a lot more specific about

Re: [GENERAL] change the order of FROM selection to make query work

2006-09-26 Thread Tom Lane
Thomas Peter [EMAIL PROTECTED] writes: the full code that does produce the error (and this error can be resolved as in OP described) is: Never oversimplify a bug report. FROM ticket as t, permission as perm, enum as p LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name =

[GENERAL] change the order of FROM selection to make query work

2006-09-26 Thread Thomas Peter
hi, posted this twice allready, but didn't seem to make it to the list. so one more try: i support a trac [1] installation and migrated the backend from sqlite to postgres 8.1.4, which worked fine, but: the following sql stopped working with postgres, and the fix of this problem seems strange to

Re: [GENERAL] change the order of FROM selection to make query work

2006-09-26 Thread Thomas Peter
Am 26.9.2006 schrieb Tom Lane [EMAIL PROTECTED]: FROM ticket as t, permission as perm, enum as p LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'fachabteilung') The above is, plain and simple, wrong. According to the SQL spec, JOIN binds more tightly than comma in a

Re: [GENERAL] change the order of FROM selection to make query work

2006-09-26 Thread Tom Lane
Thomas Peter [EMAIL PROTECTED] writes: i support a trac [1] installation and migrated the backend from sqlite to postgres 8.1.4, which worked fine, but: the following sql stopped working with postgres, Define stopped working ... what was wrong exactly? Changing the FROM order should certainly

Re: [GENERAL] copy losing information

2006-09-26 Thread Tom Lane
Silvela, Jaime \(Exchange\) [EMAIL PROTECTED] writes: I have a pretty big file, around 2 million rows, in tab-separated format, with 4 columns, that I read into a table in Postgres using the copy command. I've started to notice missing info sometimes. I'll truncate the table, read from the

Re: [GENERAL] Dead Lock problem with 8.1.3

2006-09-26 Thread Tom Lane
Kai Hessing [EMAIL PROTECTED] writes: No one any idea? *sigh* What makes you think it's a deadlock and not a very slow query? I'd be checking if the tables were all ANALYZEd and comparing EXPLAIN output to the old database ... regards, tom lane

Re: [GENERAL] serial column

2006-09-26 Thread Brandon Aiken
The problem here is that you're trying to make the relational model do something it was exactly designed *not* to do. Rows are supposed to be wholly independent of each other, but in this table, if you update row 200 of 700, you suddenly make 500 rows wrong. The implications of that are really

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Andrew Sullivan
On Tue, Sep 26, 2006 at 08:21:44AM +0200, Bo Lorentsen wrote: seems like they have some kind of statement queue (no trigger setup) and a transfer protocol all integrated in the server, and that makes it simpel. There is no understanding regarding transactions, as far as I have seen. Note

[GENERAL] Restart after power outage: createdb

2006-09-26 Thread Jon Lapham
While trying to reproduce power outage restart problem I reported earlier, I have found something odd when pulling the plug on a VM during a createdb operation. If I run... sleep 3; echo starting; createdb bar ...and power off the VM while the createdb bar is running. Upon restart, about 50%

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Jeff Davis
On Tue, 2006-09-26 at 08:21 +0200, Bo Lorentsen wrote: MySQL only takes care of the replication, not the failover ... but it seems like they have some kind of statement queue (no trigger setup) and a transfer protocol all integrated in the server, and that makes it simpel. There is no

Re: [GENERAL] Timestamp with timezone query

2006-09-26 Thread Harry Hehl
Not having any luck with this. TIME WITH TIME ZONE columns are being handle slightly different for TIMESTAMP WITH TIME ZONE. If I have the following data... mydate |mytime 2006-09-26

Re: [GENERAL] Restart after poweroutage

2006-09-26 Thread MaXX
Tom Lane wrote: Jon Lapham [EMAIL PROTECTED] writes: [...] -- Shared Memory Segments keyshmid owner perms bytes nattch status 0x 0 root 77794208 0 0x6a6b6cbd 53411843 lapham6003840 0x12ac1925

[GENERAL] Sockets and posgtres

2006-09-26 Thread J S B
Hi, I'm trying to make my database a client for an external unix based deamon process acting as a server. I was thinking of writing some clinet application in a shared object in the database (same as what we do with socket programing) that does other Db related activities as well. Would be a

[GENERAL] Transaction is read-only in auto commit mode

2006-09-26 Thread Asok Chattopadhyay
Hi,My application based on Java servlets was running fine with version PostgreSQL 7.x, but started giving error: "transaction is read-only", in version 8.0 and 8.1. I am using Suse Linux 9.3/PostgreSQL 8.0 or Suse Linux 10.1/PostgreSQL 8.1. I am using JDBC 3 drivers and all connections are in

[GENERAL] postgresql ddl scripts - drop object fails entire script

2006-09-26 Thread timasmith
On the one hand I like how the schema scripts fail when there is a single problem with a DDL statement. On the other hand sometimes it is a pain - especially to take out all the 'drop sequence', 'drop table' etc commands when creating a new database. Is there a 'drop if doesnt exist' or a

[GENERAL] Documenting stored procedures and functions

2006-09-26 Thread Jorge Godoy
Hi! I dunno if this is the best list to ask about it, but it sounded general enough to me :-) Sorry if I'm on the wrong place. I'd like to know how you're documenting your functions and stored procedures, including their usage, input and output types, description, updates/versioning, etc.

Re: [GENERAL] postgresql ddl scripts - drop object fails entire script

2006-09-26 Thread A. Kretschmer
am Sun, dem 24.09.2006, um 18:45:12 -0700 mailte [EMAIL PROTECTED] folgendes: Is there a 'drop if doesnt exist' or a better way of doing it? 8.2, read http://developer.postgresql.org/pgdocs/postgres/release-8-2.html DROP object IF EXISTS HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz:

Re: [GENERAL] postgresql rising

2006-09-26 Thread Jim Nasby
On Sep 22, 2006, at 3:33 PM, Vivek Khera wrote: On Sep 22, 2006, at 1:03 PM, Jim C. Nasby wrote: Berkus doesn't count??! He's got long hair! What more do you want?! Well, then based on volume he should count as two :-) No offense intended, Josh... *I'd* count as two, too. Nah, Josh ain't

Re: [GENERAL] copy db1 to db2

2006-09-26 Thread Jim Nasby
On Sep 25, 2006, at 9:49 AM, Bill Moran wrote: 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

Re: [GENERAL] pl/perl autonomous transactions question

2006-09-26 Thread Jim Nasby
On Sep 25, 2006, at 3:05 PM, Bob wrote: One issue I see with my current DBI solution is I need to hard code or pass in as variables the connection information. I would prefer not to have the password lying around in plain site. Keep in mind this is a batch process not a something I that

Re: [GENERAL] Restart after power outage: createdb

2006-09-26 Thread Jim Nasby
On Sep 26, 2006, at 7:06 AM, Jon Lapham wrote: While trying to reproduce power outage restart problem I reported earlier, I have found something odd when pulling the plug on a VM during a createdb operation. If I run... sleep 3; echo starting; createdb bar ...and power off the VM while the

Re: [GENERAL] Transaction is read-only in auto commit mode

2006-09-26 Thread Jim Nasby
On Sep 26, 2006, at 3:26 PM, Asok Chattopadhyay wrote: My application based on Java servlets was running fine with version PostgreSQL 7.x, but started giving error: transaction is read- only, in version 8.0 and 8.1. I am using Suse Linux 9.3/PostgreSQL 8.0 or Suse Linux 10.1/PostgreSQL 8.1.

Re: [GENERAL] Replication and PITR

2006-09-26 Thread Jim Nasby
On Sep 22, 2006, at 1:34 PM, Jeff Davis wrote: On Fri, 2006-09-22 at 07:47 +0200, Bo Lorentsen wrote: Bill Moran wrote: - No reliability. On slow days, WAL logs could take a long time to rotate, so small but important transactions might not be replicated for a long time. So it is all