[GENERAL] Session variables (how do I pass session data to a function)

2008-10-20 Thread Philip W. Dalrymple
I have a question on how to do something with Postgres that I think of by the name of "Session Variables". What I want to do is build a table that will be filled in by a trigger, it will contains three fields in addition to the fields in the table that causes the trigger that will contain the ti

Re: [GENERAL] Fwd: Copying Blobs between two tables using Insert stmt

2008-10-20 Thread Csaba Nagy
On Fri, 2008-10-17 at 13:40 -0700, John Skillings wrote: > Hello Csaba, > > Back in the month of April, I noticed that you posted a similar > request on copying blobs between two tables, having separate OID. > > Can you let me know your final solution please. The final version I'm using is this

Re: [GENERAL] IS NULL seems to return false, even when parameter is NULL

2008-10-20 Thread Richard Huxton
Andrus wrote: >> I have a strange problem with the following condition in a SELECT: >> AND (("TableData" = "inDate") OR ("inDate" IS NULL)) >> >> it works perfectly when the input date in the function (inDate) matchs >> a date in the table, but it does not work when the parameter inDate is >> NULL.

Re: re[GENERAL] moving a portion of text

2008-10-20 Thread Sam Mason
On Mon, Oct 20, 2008 at 04:21:31AM -0700, pere roca wrote: > I have a column with full of data like ATB-OO NCK-TT how can I > easily remove the "-" ? If you just want to remove all the dashes then I'd use a regex; something like: UPDATE table SET data = regexp_replace(data, '-', '', 'g'

Re: [GENERAL] IS NULL seems to return false, even when parameter is NULL

2008-10-20 Thread Andrus
Richard, Seems to work here: select (true or null) as a, (null or true) as b, (null or false) as c, (false or null) as d; a | b | c | d ---+---+---+--- t | t | | (1 row) I'm sorry for the wrong information. Andrus. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To m

Re: [GENERAL] IS NULL seems to return false, even when parameter is NULL

2008-10-20 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > PostgreSQL OR is not commutative if left operand evaluates to NULL. This is nonsense. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresq

[GENERAL] Slow delete with with cascading foreign keys

2008-10-20 Thread Matthias Karlsson
Hi, I have a rather complex set of relations, connected with cascading foreign keys on delete. I'm experiencing very slow performance when deleting *the* lead node, which everything eventually depends on. The number of records ultimately to be deleted aren't that many (perhaps 2000-3000) but there

re[GENERAL] moving a portion of text

2008-10-20 Thread pere roca
hi, I have a column with full of data like ATB-OO NCK-TT how can I easily remove the "-" ? it seems that the "-" is allways the fourth letter. thanks, Pere -- View this message in context: http://www.nabble.com/removing-a-portion-of-text-tp20067248p20067248.html Sent from the Postg

Re: [GENERAL] Slow delete with with cascading foreign keys

2008-10-20 Thread Tom Lane
"Matthias Karlsson" <[EMAIL PROTECTED]> writes: > I have a rather complex set of relations, connected with cascading > foreign keys on delete. I'm experiencing very slow performance when > deleting *the* lead node, which everything eventually depends on. The > number of records ultimately to be del

[GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Sergey Konoplev
Hi all, Well, we have migrated our server from 8.3.3 to 8.3.4. The server is based on Red Hat and an instans it deals with insalled on RAMFS. db_online=> select version(); version PostgreSQL 8.3.4 on x86_64-

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Tom Lane
"Sergey Konoplev" <[EMAIL PROTECTED]> writes: > Will somebody explain what has happened and how to solve the problem please? Apparently you've found a bug in either btree_gist or the core GIST code. Can you put together a self-contained test case? regards, tom lane -- S

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Sergey Konoplev
Sorry, I forget to paste explains > explain showed that first query do index scan and second one sec scan. > db_online=> select obj_status_did, count(1) from person_online where obj_status_did = 1 group by obj_status_did; QUERY PLAN

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Tom Lane
"Sergey Konoplev" <[EMAIL PROTECTED]> writes: > db_online=> select obj_status_did, count(1) from person_online > where obj_status_did = 1 group by obj_status_did; > QUERY PLAN > -

Re: [GENERAL] Session variables (how do I pass session data to a function)

2008-10-20 Thread Harald Armin Massa
Philip, "session variables" is the perfect name for this kind of use; and googling it up some times ago lead me to a) a temp table implementation b) some shared memory implementation of these I can present you with a), written to store an integer user-ID; you can adjust it accordingly: CREATE O

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Sergey Konoplev
> "Sergey Konoplev" <[EMAIL PROTECTED]> writes: >> Will somebody explain what has happened and how to solve the problem please? > > Apparently you've found a bug in either btree_gist or the core GIST > code. Can you put together a self-contained test case? > Ok, I will try. One more thing I want

Re: re[GENERAL] moving a portion of text

2008-10-20 Thread Lennin Caro
--- On Mon, 10/20/08, pere roca <[EMAIL PROTECTED]> wrote: > From: pere roca <[EMAIL PROTECTED]> > Subject: re[GENERAL] moving a portion of text > To: pgsql-general@postgresql.org > Date: Monday, October 20, 2008, 11:21 AM > hi, > I have a column with full of data like ATB-OO NCK-TT > h

Re: [GENERAL] [ODBC] Error in Adding All Table

2008-10-20 Thread Andrei Kovalevski
Hello, What PostgreSQL server and ODBC driver version do you use? salman Sheikh wrote: Hi freinds, i wanted to add my all tables once in MFC application,normally we add it one by one. If i add all table by pressing control and click on all table ,i can add them,but by debugging it shows me alw

[GENERAL] Error in Adding All Table

2008-10-20 Thread salman Sheikh
Hi freinds, i wanted to add my all tables once in MFC application,normally we add it one by one. If i add all table by pressing control and click on all table ,i can add them,but by debugging it shows me always errors. ERROR: column reference "ctid" is ambiguous; Error while executing the

Re: [GENERAL] IS NULL seems to return false, even when parameter is NULL

2008-10-20 Thread Andrus
I have a strange problem with the following condition in a SELECT: AND (("TableData" = "inDate") OR ("inDate" IS NULL)) it works perfectly when the input date in the function (inDate) matchs a date in the table, but it does not work when the parameter inDate is NULL. I recall the function with pg

Re: [GENERAL] Drupal and PostgreSQL - performance issues?

2008-10-20 Thread Michelle Konzack
Am 2008-10-16 23:17:35, schrieb Mikkel Høgh: > P.S.: Why are e-mails from this list not sent with a Reply-To: header > of the lists e-mail-address? Because if I hit I want to send a private message and if I hit it goes to the list andthe all people get bulk-mail from me? If you hav

Re: [GENERAL] Annoying Reply-To

2008-10-20 Thread Michelle Konzack
Hi Martinn, here the great Dictator Michelle! Am 2008-10-17 10:24:44, schrieb Martin Gainty: > > free unfettered and open discussion without interference from ANY entity is a > requirement of a democracy > the REAL question is ..is this a democracy??? Shut-Up or I will install you Micr0$of SQL

Re: [GENERAL] Annoying Reply-To

2008-10-20 Thread Michelle Konzack
Am 2008-10-17 08:12:00, schrieb Scott Marlowe: > I prefer the list the way it is. And so do a very large, very silent > majority of users. I agree with you. I am on Mailinglist since I use the Internet (1995) and there are not very much mailinglists which manipulate the "Reply-To:" Header...

Re: [GENERAL] Drupal and PostgreSQL - performance issues?

2008-10-20 Thread Michelle Konzack
Am 2008-10-17 12:13:00, schrieb Mikkel Høgh: > Besides, the if the Reply-To thing is so dangerous, why do most other > mailing lists do it? Curently I am on 117 Mailinglists and ONLY 2 Winsuck lists do this crap. So, from what are you talking about? Thanks, Greetings and nice Day/Evening Mi

Re: [GENERAL] Annoying Reply-To

2008-10-20 Thread Michelle Konzack
Am 2008-10-17 08:42:46, schrieb Andrew Sullivan: > My suggestion would be to use a mail user agent that knows how to read > the list headers, which were standardized many years ago. Then you > "reply to list". Mutt has done this for at least a few years now. I > don't know about other MUAs. N.C

[GENERAL] Hot Standby utility and administrator functions

2008-10-20 Thread Simon Riggs
I'm looking to implement the following functions for Hot Standby, to allow those with administrative tools or management applications to have more control during recovery. Please let me know if other functions are required. What else do we need? * pg_is_in_recovery() returns bool (true if in rec

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Teodor Sigaev
Hmm. So the problem seems to be statable as "a full-index scan on a GIST index might fail to return all the rows, if the index has been modified since creation". Teodor, can you think of anything you changed recently in that area? Only fixing possible duplicates during index scan. Will see. -

Re: [GENERAL] Annoying Reply-To

2008-10-20 Thread Martin Gainty
since you are not an advocate of democracy I bid you adieu Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sende

[GENERAL] pg_dump is ignoring my pgpass file

2008-10-20 Thread Luca Ferrari
Hi all, I'm running 8.2.9, and I've got a curious problem on a database of my cluster. I've got my pgpass file: [EMAIL PROTECTED]:~$ cat ~/.pgpass 192.168.1.2:5432:raydb:ray:xxx 192.168.1.2:5432:hrpmdb:hrpm:x 192.168.1.2:5432:vatcontrollerdb:vatcontroller:xx and if I connect from the

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Teodor Sigaev
Hmm. So the problem seems to be statable as "a full-index scan on a GIST index might fail to return all the rows, if the index has been modified since creation". Teodor, can you think of anything you changed recently in that area? I still can't reproduce the bug, but found useless recheck cond

[GENERAL] Using a variable as tablename ins plpgsql?

2008-10-20 Thread Glyn Astill
Hi people, Hopefully this is a quickie, I want to pass in a table name to a plpgsql function and then use that table name in my queries. Is EXECUTE the only way to do this? Ta Glyn Send instant messages to your online friends http://uk.messenger.yahoo.com -- Sent via pgsql-general mail

Re: [GENERAL] Using a variable as tablename ins plpgsql?

2008-10-20 Thread Pavel Stehule
Hello 2008/10/20 Glyn Astill <[EMAIL PROTECTED]>: > Hi people, > > Hopefully this is a quickie, I want to pass in a table name to a plpgsql > function and then use that table name in my queries. > > Is EXECUTE the only way to do this? > > Ta > Glyn > yes, regards Pavel Stehule > > > > > > > Se

Re: [GENERAL] Using a variable as tablename ins plpgsql?

2008-10-20 Thread Fernando Moreno
2008/10/20 Glyn Astill <[EMAIL PROTECTED]> > Hi people, > > Hopefully this is a quickie, I want to pass in a table name to a plpgsql > function and then use that table name in my queries. > > Is EXECUTE the only way to do this? > As far as I know, yes. That's the only way to create queries using

[GENERAL] Booth Volunteers for LISA 08 (San Diego)

2008-10-20 Thread Joshua Drake
Hello, PostgreSQL is going to have a booth at LISA: http://www.usenix.org/event/lisa08/ http://www.usenix.org/event/lisa08/exhibition.html Currently we are confirmed for Joshua Drake and Richard Broeserma. However due to an excessive travel schedule by me, it would be great to find a few folks t

Re: [GENERAL] Booth Volunteers for LISA 08 (San Diego)

2008-10-20 Thread Martin Gainty
let us know when they come to btown or chicago Thanks Joshua Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Se

Re: [GENERAL] index scan leads to result that is different from sec scan after upgrading to 8.3.4

2008-10-20 Thread Tom Lane
Teodor Sigaev <[EMAIL PROTECTED]> writes: > I still can't reproduce the bug, but found useless recheck condition with > bitmap > check: > select 1 as st , 1::int4 as t into qq from generate_series(1,1) as t; > create index qqidx on qq using gist (st) where t =1; > INSERT INTO qq (SELECT (4 *

Re: [GENERAL] Slow delete with with cascading foreign keys

2008-10-20 Thread Matthias Karlsson
Tom Lane skrev: "Matthias Karlsson" <[EMAIL PROTECTED]> writes: I have a rather complex set of relations, connected with cascading foreign keys on delete. I'm experiencing very slow performance when deleting *the* lead node, which everything eventually depends on. The number of records ultimatel

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-20 Thread Robert Haas
> * pg_last_recovered_xact_xid() > Will throw an ERROR if *not* executed in recovery mode. > returns bigint > > * pg_last_completed_xact_xid() > Will throw an ERROR *if* executed in recovery mode. > returns bigint Should these return xid? ...Robert -- Sent via pgsql-general mailing list (pgsql-

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-20 Thread Simon Riggs
On Mon, 2008-10-20 at 16:22 -0400, Robert Haas wrote: > > * pg_last_recovered_xact_xid() > > Will throw an ERROR if *not* executed in recovery mode. > > returns bigint > > > > * pg_last_completed_xact_xid() > > Will throw an ERROR *if* executed in recovery mode. > > returns bigint > > Should thes

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-20 Thread Alvaro Herrera
Simon Riggs escribió: > > On Mon, 2008-10-20 at 16:22 -0400, Robert Haas wrote: > > > * pg_last_recovered_xact_xid() > > > Will throw an ERROR if *not* executed in recovery mode. > > > returns bigint > > > > > > * pg_last_completed_xact_xid() > > > Will throw an ERROR *if* executed in recovery mod

[GENERAL] Debian no longer dumps cores?

2008-10-20 Thread Alvaro Herrera
Hi, My Debian system (now running Linux 2.6.26) is no longer dumping core files, and I can't figure out why :-( Of course, I've set ulimit -c to unlimited, and I'm running the postmaster directly in the same shell (no pg_ctl or init scripts), but it's still not working. I'm not sure where else t

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-20 Thread Simon Riggs
On Mon, 2008-10-20 at 17:44 -0300, Alvaro Herrera wrote: > Simon Riggs escribió: > > > > On Mon, 2008-10-20 at 16:22 -0400, Robert Haas wrote: > > > > * pg_last_recovered_xact_xid() > > > > Will throw an ERROR if *not* executed in recovery mode. > > > > returns bigint > > > > > > > > * pg_last_co

[GENERAL] How best to implement a multi-table constraint?

2008-10-20 Thread Karl Nack
Hello all, I'm a bit of a newb designing a database to hold landcover information for properties in a city. Here's some simple sample data: property: property_name*, property_area - sample house, 2500 property_landcover: property_name*, landcover_name*, landcover_are

Re: [GENERAL] [HACKERS] Debian no longer dumps cores?

2008-10-20 Thread Greg Smith
On Mon, 20 Oct 2008, Alvaro Herrera wrote: My Debian system (now running Linux 2.6.26) is no longer dumping core files, and I can't figure out why :-( My guess is that you're being nailed by one of the changes related to implementing the improved capabilities interface made in 2.6.25 or 2.6.2

[GENERAL] Can PL/PGSQL function return multiple SETOFs

2008-10-20 Thread cyw
Is something like this possible? CREATE testsetof( IN toad_id integer) RETURNS SETOF road_table, SETOF int4 AS $BODY$ If yes, is this the way to do 'RETURN NEXT'? RETURN NEXT road_table_row, an_integer; Thanks CYW -- Sent via pgsql-general mailing list (pgsql-general@postgresql.o

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-20 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > On Mon, 2008-10-20 at 17:44 -0300, Alvaro Herrera wrote: >> That's been "extended with an epoch counter" per the docs; I don't think >> that's appropriate for the new functions, is it? > I assumed it was, so you can subtract them easily. > It can be done

Re: [GENERAL] Slow delete with with cascading foreign keys

2008-10-20 Thread Tom Lane
Matthias Karlsson <[EMAIL PROTECTED]> writes: > Tom Lane skrev: >> If it's a reasonably modern PG version, EXPLAIN ANALYZE will break out >> the time spent in each on-delete trigger, which should be enough to >> answer the question. > Thanks, that gave me something to work with. I targeted the tri

Re: [GENERAL] pg_dump is ignoring my pgpass file

2008-10-20 Thread Tom Lane
Luca Ferrari <[EMAIL PROTECTED]> writes: > I've got my pgpass file: > [EMAIL PROTECTED]:~$ cat ~/.pgpass > 192.168.1.2:5432:raydb:ray:xxx > 192.168.1.2:5432:hrpmdb:hrpm:x > 192.168.1.2:5432:vatcontrollerdb:vatcontroller:xx > ... But if I try to execute the following: > pg_dump --crea

Re: [GENERAL] Session variables (how do I pass session data to a function)

2008-10-20 Thread Guy Rouillier
Philip W. Dalrymple wrote: What I want to do is to add to this another field that will be NULL UNLESS the session sets a value to the "user" for that the middle-wear system is acting for. This can be done via a setting. See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNC

Re: [GENERAL] Can PL/PGSQL function return multiple SETOFs

2008-10-20 Thread Pavel Stehule
Hello plpgsql should return only one set. You should to returns set of cursors - that is real multisets. http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html regards Pavel Stehule 2008/10/21 <[EMAIL PROTECTED]>: > Is something like this possible? > CREATE testsetof( IN toad_id in

Re: [GENERAL] [HACKERS] Debian no longer dumps cores?

2008-10-20 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Oct 20, 2008 at 05:49:04PM -0300, Alvaro Herrera wrote: > Hi, > > My Debian system (now running Linux 2.6.26) is no longer dumping core > files, and I can't figure out why :-( FWIW, same happens here, out-of-the-box 2.6.26-1 vanilla Debian. B