Re: [GENERAL] insert rule instead oddity

2007-03-13 Thread Sim Zacks
A trigger did work, thank you for that suggestion. In a race situation, there really is no manual solution either I sent in a bug report for the rule problem that I experienced. Sim Tom Lane wrote: Martijn van Oosterhout writes: I don't think rules can do what you want. A trigger might work

Re: [GENERAL] Exception handling in plperl

2007-03-13 Thread Michael Fuhr
On Tue, Mar 13, 2007 at 11:23:03PM -0400, Jasbinder Singh Bali wrote: > I have a stored procedure written in plperl. > This procedure has series of inserts at various levels. A few inserts on > certain tables invoke triggers > that launch tools outside the domain of the database. > > How can I mak

Re: [GENERAL] Where is contrib?

2007-03-13 Thread Uwe C. Schroeder
Thanks Stuart. I somehow overlooked it all the time. In the end I ran updatedb and locate :-) Guess it's time to get some sleep. Uwe On Tuesday 13 March 2007 22:40, Stuart Cooper wrote: > > this may be a very stupid question. I've always used the source rpms for > > new versions. However now I'm

Re: [GENERAL] Where is contrib?

2007-03-13 Thread Stuart Cooper
this may be a very stupid question. I've always used the source rpms for new versions. However now I'm faced with a ubuntu server and I never used a non-rpm system. Since there is no up-to-date postgresql package I grabbed the source for 8.1.8 and compiled/installed it. So far so good. Now I'm loo

Re: [GENERAL] Where is contrib?

2007-03-13 Thread Uwe C. Schroeder
Never mind. Dumb me. Uwe On Tuesday 13 March 2007 22:17, Uwe C. Schroeder wrote: > Hi everyone, > > this may be a very stupid question. I've always used the source rpms for > new versions. However now I'm faced with a ubuntu server and I never used a > non-rpm system. > Since there is no up-to-d

[GENERAL] Where is contrib?

2007-03-13 Thread Uwe C. Schroeder
Hi everyone, this may be a very stupid question. I've always used the source rpms for new versions. However now I'm faced with a ubuntu server and I never used a non-rpm system. Since there is no up-to-date postgresql package I grabbed the source for 8.1.8 and compiled/installed it. So far so

Re: [GENERAL] Multiple atributes with -P switch to psql

2007-03-13 Thread Harvey, Allan AC
Stuart, Thanks for the reply. You are dead right, and as expected the problem is not with psql. > $ psql -H -P tableattr='width="80%" bgcolor="#FF"' > > works for me. Carefully study my nice simple quoting: single quotes '' > around the whole > tableattr='THING' shebang and non-escaped dou

Re: [GENERAL] Multiple atributes with -P switch to psql

2007-03-13 Thread Stuart Cooper
Hi Allan, TABLEOPTIONS="-P border=5 -P tableattr=width=\"80%\" -P tableattr=bgcolor=\"#FF\"" produces ... ... Seems to hang on to the last. Yes- you've said -P tableattr twice so the second one overrides the first one. $ psql -H -P tableattr='width="80%" bgcolor="#FF"' wor

[GENERAL] Multiple atributes with -P switch to psql

2007-03-13 Thread Harvey, Allan AC
Hi all, Trying to get psql to produce multiple table attributes in the tag when psql is used with the -H switch. eg TABLEOPTIONS="-P border=5 -P tableattr=width=\"80%\"" psql $DATABASEHOST -U $DATABASEUSER -d $DATABASE -q -P footer -P title=Summary -H $TABLEOPTIONS produces ... ... As expe

[GENERAL] Exception handling in plperl

2007-03-13 Thread Jasbinder Singh Bali
Hi, I have a stored procedure written in plperl. This procedure has series of inserts at various levels. A few inserts on certain tables invoke triggers that launch tools outside the domain of the database. How can I make everything as one single transaction and simply roll back everything whene

Re: [GENERAL] OT: Canadian Tax Database

2007-03-13 Thread Jeff Davis
On Fri, 2007-03-09 at 19:40 -0800, omar wrote: > below.) This behavior is a feature, not a bug. A database is suppose to > store and retrieve data and it should not matter to the database what > format that data is in. The strong typing system found in most other SQL In my opinion, this is the

Re: [GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Joshua D. Drake
Reece Hart wrote: > On Tue, 2007-03-13 at 18:16 -0400, Alvaro Herrera wrote: > >> On the other hand it would be scary to have the elevator "change its >> mind" on the middle of carrying you to 20th and suddenly opening the >> floor for dumping you to the basement instead. Which one would think >>

Re: [GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Reece Hart
On Tue, 2007-03-13 at 18:16 -0400, Alvaro Herrera wrote: > On the other hand it would be scary to have the elevator "change its > mind" on the middle of carrying you to 20th and suddenly opening the > floor for dumping you to the basement instead. Which one would think > is > pretty much what mus

Re: [GENERAL] Stored procedure

2007-03-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-13 18:29:36 +0100: > Hi, > > I have a stored procedure which returns a SETOF RECORD. > so basically a partial rowtype from a table. > > to execute the query in PHP, i must write : > select * from myschema.sp_a_002('username') as result(Column1 varchar); > > to get t

Re: [GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Alvaro Herrera
Reece Hart wrote: > On Tue, 2007-03-13 at 17:44 -0400, Tom Lane wrote: > > > are you in the habit of > > banging on ^C repeatedly? I couldn't reproduce such a problem in a > > small amount of testing though. > > You mean C-c doesn't work like elevator buttons? No, it's much better because you

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Tom Lane wrote: BTW, you said you were on FC6, but what kernel version exactly? (uname -a is good) [EMAIL PROTECTED] > uname -a Linux bilbo.localdomain 2.6.19-1.2911.6.5.fc6 #1 SMP Sun Mar 4 16:05:34 EST 2007 x86_64 x86_64 x86_64 GNU/Linux [EMAIL PROTECTED] > cat /proc/cpuinfo processor

Re: [GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Reece Hart
On Tue, 2007-03-13 at 17:44 -0400, Tom Lane wrote: > are you in the habit of > banging on ^C repeatedly? I couldn't reproduce such a problem in a > small amount of testing though. You mean C-c doesn't work like elevator buttons? It wouldn't surprise me that I hit repeatedly. I certainly reme

Re: [GENERAL] Questions regarding generating the WAL File.

2007-03-13 Thread Alan Hodgson
On Tuesday 13 March 2007 14:23, "Dhaval Shah" <[EMAIL PROTECTED]> wrote: > On the reverse, can I indicate to a db in recovery mode to start > consuming WAL Files from a particular number? > The recovery process is documented at http://www.postgresql.org/docs/8.2/interactive/continuous-archiving.

Re: [GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Tom Lane
Reece Hart <[EMAIL PROTECTED]> writes: > The manual clearly says that a each row in pg_database will have a > corresponding subdirectory in base/. Is the converse also true, ie, > should every subdir in base/ also have a row in pg_database? If so, am > I safe to rm the unreferenced subdirectories

Re: [GENERAL] New US DST Rules & PostgreSQL

2007-03-13 Thread Tom Lane
"Thomas F. O'Connell" <[EMAIL PROTECTED]> writes: > I'm curious. For 7.4.x, does the database require a restart for the > change to take effect? I'm aware of a few production installations > where the OS changed, but postgres time functions didn't take hold. Yes, probably. On those systems yo

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
BTW, you said you were on FC6, but what kernel version exactly? (uname -a is good) regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if

[GENERAL] Questions regarding generating the WAL File.

2007-03-13 Thread Dhaval Shah
If I put a postgres 8.2 in an archive mode, it starts logging the WAL files. The db starts the WAL File from 1001.gz and continually increments the number. Is there a control on 8.2 where I can indicate the number of the WAL file to start from? On the reverse, can I indicate to a db in r

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
Jon Lapham <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Just for completeness, could we see the output of "ipcs -a" now? > [EMAIL PROTECTED] ~]# ipcs -a Thanks. The postgres segment looks pretty standard here. I'm a bit curious what all the lapham-owned destroyed segments are --- any idea? A

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Tom Lane wrote: Jon Lapham <[EMAIL PROTECTED]> writes: Tom Lane wrote: It would seem that maybe your kernel has a different idea of what EIDRM means than we do. You say this persists across a reboot? I probably should have asked before doing this... but I just rebooted and postgresql came u

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
Jon Lapham <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> It would seem that maybe your kernel has a different idea of what EIDRM >> means than we do. You say this persists across a reboot? > I probably should have asked before doing this... but I just rebooted > and postgresql came up fine.

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Tom Lane wrote: Oh, that's interesting. The code is barfing on this because /* * Otherwise, we had better assume that the segment is in use. The * only likely case is EIDRM, which implies that the segment has been * IPC_RMID'd but there are still processes att

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
Jon Lapham <[EMAIL PROTECTED]> writes: > chdir("/var/lib/pgsql/data")= 0 > open("postmaster.pid", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File > exists) > open("postmaster.pid", O_RDONLY)= 3 > read(3, "2809\n/var/lib/pgsql/data\n 54320"..., 1123) = 45 > close(3)

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Tom Lane wrote: Jon Lapham <[EMAIL PROTECTED]> writes: Tom Lane wrote: Let's see the output from sudo ipcs -a [EMAIL PROTECTED] ~]# ipcs -a [ no postgres-owned segments... ] Well, that's dang interesting. Could you run the postmaster under strace and send the output? Let me know if thi

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
Jon Lapham <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Let's see the output from >> sudo ipcs -a > [EMAIL PROTECTED] ~]# ipcs -a [ no postgres-owned segments... ] Well, that's dang interesting. Could you run the postmaster under strace and send the output? regards,

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Tom Lane wrote: Jon Lapham <[EMAIL PROTECTED]> writes: What can I do to help diagnose what is happening? Let's see the output from ps auxww | grep postgres sudo ipcs -a [EMAIL PROTECTED] ~]# ps auxww | grep postgres root 3969 0.0 0.0 60272 688 pts/1R+ 15:47 0:00 grep postg

Re: [GENERAL] Restart after poweroutage

2007-03-13 Thread Tom Lane
Jon Lapham <[EMAIL PROTECTED]> writes: > What can I do to help diagnose what is happening? Let's see the output from ps auxww | grep postgres sudo ipcs -a (or local equivalents) regards, tom lane ---(end of broadcast)--- TI

[GENERAL] Restart after poweroutage

2007-03-13 Thread Jon Lapham
Today I had a power outage which upon reboot seems to have done something to cause Postgresql to not restart properly. This has happened to me before: http://archives.postgresql.org/pgsql-general/2006-09/msg00938.php ...and during this previous discussion, Tom Lane pointed out that I may have

Re: [GENERAL] Stored procedure

2007-03-13 Thread David Legault
On 3/13/07, Alain Roger <[EMAIL PROTECTED]> wrote: Hi, I have a stored procedure which returns a SETOF RECORD. so basically a partial rowtype from a table. to execute the query in PHP, i must write : select * from myschema.sp_a_002('username') as result(Column1 varchar); to get the result. H

Re: [GENERAL] New US DST Rules & PostgreSQL

2007-03-13 Thread Thomas F. O'Connell
On Jan 23, 1:18 am, [EMAIL PROTECTED] (Tom Lane) wrote: > Adam Gordon <[EMAIL PROTECTED]> writes: > > Anyone know where to find info about whether or not the new USDSTrules > > impact certain versions of Postgres and what needs to be done to ensure > > observance of the new rules? Thanks. >

[GENERAL] Stored procedure

2007-03-13 Thread Alain Roger
Hi, I have a stored procedure which returns a SETOF RECORD. so basically a partial rowtype from a table. to execute the query in PHP, i must write : select * from myschema.sp_a_002('username') as result(Column1 varchar); to get the result. However, is there another to get the result without us

[GENERAL] orphaned PGDATA/base/ subdirectories

2007-03-13 Thread Reece Hart
setup: postgresql 8.1.8, x86_64, gnu/linux I recently used createdb -T to copy a large database and the process failed due to disk full, but the space wasn't freed after that failure. That led me to wonder how much of my disk usage was from failed or interrupted operations. In the 8.1.8 manual, C

Re: [GENERAL] More information on how to understand table pg_locks.

2007-03-13 Thread Tom Lane
"Olivier Ceulemans" <[EMAIL PROTECTED]> writes: > I'm running 'PostgreSQL 8.2.0 on i686pc-mingw32, compiled by GCC gcc.exe > (GCC) 3.4.2 (mingw-special)'. BTW: you oughta think about an update to 8.2.3; we've fixed several nasty bugs, most especially in the windows port. > Transaction B is simply

Re: [GENERAL] PgAgent logging verbosity

2007-03-13 Thread Dave Page
Ezequias Rodrigues da Rocha wrote: Hi list, I would like to know if I set the debug mode to 2 (-l 2) in the pgAgent connection string it could spend much cpu processing. I have other things running in the server and I don't like to create problem to others. Please stop cross posting to lot

Re: [GENERAL] More information on how to understand table pg_locks.

2007-03-13 Thread Olivier Ceulemans
I'm running 'PostgreSQL 8.2.0 on i686pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)'. My intuition about the lock acquired foreign keys seems right. Here is a short description: (if it can help someone else one day...) create table y { y_id bigint not null, y_coun

[GENERAL] PgAgent logging verbosity

2007-03-13 Thread Ezequias Rodrigues da Rocha
Hi list, I would like to know if I set the debug mode to 2 (-l 2) in the pgAgent connection string it could spend much cpu processing. I have other things running in the server and I don't like to create problem to others. -- Ezequias Rodrigues da Rocha http://ezequiasrocha.blogspot.com/ use Mo

Re: [GENERAL] How to disable displaying of a NOTICE context?

2007-03-13 Thread Dmitry Koterov
Thanks! With RAISE NOTICE "terse" mode works great, CONTEXT is not shown. But does "terse" also disable CONTEXT displaying on fatal errors inside a stored function? If it does, it is not so useful as it could be, because I don't think that fatal error context hiding is a good idea... No document

Re: [GENERAL] PostgreSQL crashes on Windows 2003

2007-03-13 Thread Richard Huxton
Joost Kraaijeveld wrote: Hi all, Thanks for looking into it. The problem is solved: on both machines there appeared to be a hung-up backup process that locked PostgreSQL. If that's a file-level backup, you'll want to exclude the PG directories (or stop the database while the backup occurs).

Re: [GENERAL] PostgreSQL crashes on Windows 2003

2007-03-13 Thread Joost Kraaijeveld
Hi all, Thanks for looking into it. The problem is solved: on both machines there appeared to be a hung-up backup process that locked PostgreSQL. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---

Re: [GENERAL] How to disable displaying of a NOTICE context?

2007-03-13 Thread Tom Lane
"Dmitry Koterov" <[EMAIL PROTECTED]> writes: > Is there any way to disable CONTEXT displaying with still enabled NOTICEs > text? You could do "\set VERBOSITY terse" regards, tom lane ---(end of broadcast)--- TIP 6: explain a

Re: [GENERAL] More information on how to understand table pg_locks.

2007-03-13 Thread Tom Lane
"Olivier Ceulemans" <[EMAIL PROTECTED]> writes: > I wrote an application making 'advanced' use of transactions. The > application is not tied to a specific kind of database. It runs fine on > oracle, db2, sql server but I run into a deadlock on postgresql. > ... > For transaction A, I have a RowSha

[GENERAL] How to disable displaying of a NOTICE context?

2007-03-13 Thread Dmitry Koterov
Hello. With debug purposes I use RAISE NOTICE ... inside my stored functions/triggers. But there is a little problem: if I run this function/trigger inside psql command-line client (e.g.), it shows not only a notice text, but also a caller context (started with "CONTEXT" substring) which looks qu

[GENERAL] More information on how to understand table pg_locks.

2007-03-13 Thread Olivier Ceulemans
Hi All, I wrote an application making 'advanced' use of transactions. The application is not tied to a specific kind of database. It runs fine on oracle, db2, sql server but I run into a deadlock on postgresql. I have two transactions (let's say A & B). These two transactions are initiated by t

Re: [GENERAL] Multi DB performance test

2007-03-13 Thread Scott Marlowe
On Mon, 2007-03-12 at 23:46, Tom Lane wrote: > "Tadej Kanizar" <[EMAIL PROTECTED]> writes: > > http://devloop.org.uk/documentation/database-performance/ > > Any comments? > > Old news, see this thread: > http://archives.postgresql.org/pgsql-general/2007-02/msg00806.php > > Most of us stopped read

Re: [GENERAL] insert rule instead oddity

2007-03-13 Thread Tom Lane
Martijn van Oosterhout writes: > I don't think rules can do what you want. A trigger might work, ignoring the problem of race conditions between two inserts happening concurrently (which a rule can't handle either). regards, tom lane ---(end of br

Re: [GENERAL] insert rule instead oddity

2007-03-13 Thread Sim Zacks
I misunderstood you. What you are saying is that since the insert is done first and then the update when it gets to the update it checks the rule and even though it wasn't valid when the statement was executed, it is valid at the time of execution and therefore it runs. I have tried another te

Re: [GENERAL] one-to-one schema design question and ORM

2007-03-13 Thread alexander krohn
hi. Rick Schumeyer wrote: [...] From a business rules perspective: Some users are not employees (like an admin user) Some employees are not users [...] from my view users and employees have something in common: they are persons. why don't create a person-table with the attributes the grou

Re: [GENERAL] OT: Canadian Tax Database

2007-03-13 Thread Guy Fraser
On Sat, 2007-03-10 at 08:07 -0300, Jorge Godoy wrote: > omar <[EMAIL PROTECTED]> writes: > > > I'm curious what people think about the following statement considering the > > database typing talk being brought up here. My experience is that more > > times > > than not I have to put data validati

Re: [GENERAL] insert rule instead oddity

2007-03-13 Thread Sim Zacks
I would think the rule qualification would tell the system not to run the rule in the event that it does not meet the qualification. According to the docs: What is a rule qualification? It is a restriction that tells when the actions of the rule should be done and when not. This qualification

Re: [GENERAL] Tracking disk writes? (again) & bgwriter

2007-03-13 Thread Erik Jones
On Mar 12, 2007, at 10:57 PM, Tom Lane wrote: Alvaro Herrera <[EMAIL PROTECTED]> writes: Tom Lane wrote: One of the reasons you don't see that is that a large fraction of the writes are triggered in background by the "bgwriter" process, which operates at too low a level to participate in th

Re: [GENERAL] insert rule instead oddity

2007-03-13 Thread Martijn van Oosterhout
On Tue, Mar 13, 2007 at 02:15:01PM +0200, Sim Zacks wrote: > select version() > "PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC > i686-pc-linux-gnu-gcc (GCC) 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, > pie-8.7.7.1)" > > I am sure that I must have missed something here because I read th

[GENERAL] insert rule instead oddity

2007-03-13 Thread Sim Zacks
select version() "PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc (GCC) 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)" I am sure that I must have missed something here because I read the documentation and searched the forums and it all seems fairly strai

Re: [GENERAL] finding a column by name in psql

2007-03-13 Thread Guillaume Bog
On 13/03/07, Merlin Moncure <[EMAIL PROTECTED]> wrote: On 3/12/07, Guillaume Bog <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm now used to using psql to manage my databases into a terminal, and > I found the very convenient "\g |" command that pipes query result in > any shell tool I want. Bu

Re: [GENERAL] Incorrect "ERROR: database "xxx" is being accessed by other users"

2007-03-13 Thread Dmitry Koterov
Thanks a lot! All works! So - I propose to change error message from ERROR: database "xxx" is being accessed by other users to ERROR: database "xxx" is being accessed by other users or there are prepared transactions exist (please use "SELECT * FROM pg_prepared_xacts" and "ROLLBACK PREPARED

Re: [GENERAL] Incorrect "ERROR: database "xxx" is being accessed by other users"

2007-03-13 Thread Michael Fuhr
On Tue, Mar 13, 2007 at 11:41:46AM +0300, Dmitry Koterov wrote: > Yes, I have one! > How to remove it now? I tried DEALLOCATE for gid returned by > > select * from pg_prepared_xacts; > > but it says "prepared statement does not exist"... DEALLOCATE is for prepared *statements*; you have a prepar

Re: [GENERAL] Incorrect "ERROR: database "xxx" is being accessed by other users"

2007-03-13 Thread Albe Laurenz
Dmitry Koterov wrote: >> Have you checked for prepared transactions in that DB? See >> pg_prepared_xacts view (I've been burnt by that myself...) > > Yes, I have one! > How to remove it now? I tried DEALLOCATE for gid returned by > > select * from pg_prepared_xacts; > > but it says "prepared s

Re: [GENERAL] Incorrect "ERROR: database "xxx" is being accessed by other users"

2007-03-13 Thread Dmitry Koterov
Yes, I have one! How to remove it now? I tried DEALLOCATE for gid returned by select * from pg_prepared_xacts; but it says "prepared statement does not exist"... Database restart does not reset the prepared transaction... On 3/13/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Dmitry Koterov" <[EMA

Re: [GENERAL] Incorrect "ERROR: database "xxx" is being accessed by other users"

2007-03-13 Thread Tom Lane
"Dmitry Koterov" <[EMAIL PROTECTED]> writes: > I have a database which I cannot delete (the same for rename): > ERROR: database "xxx" is being accessed by other users > But it is NOT accessed by anybody, because: Have you checked for prepared transactions in that DB? See pg_prepared_xacts view (