[GENERAL] Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

2010-09-11 Thread Nick
CREATE FUNCTION test() RETURNS text LANGUAGE plpgsql AS $$DECLARE num_var TEXT; BEGIN FOR i IN 1..10 LOOP num_var := num_var || ',' || i; END LOOP; RETURN num_var; END;$$; SELECT test(); returns NULL -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To ma

Re: [GENERAL] How to inherit search_path from template

2010-09-11 Thread Phui Hock
That answers a lot of my doubts with regard to search_path. Thanks! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

2010-09-11 Thread Nick
Woops, figured it out. Just needed to declare the num_var := ''; On Sep 11, 10:45 pm, Nick wrote: > CREATE FUNCTION test() RETURNS text >     LANGUAGE plpgsql >     AS $$DECLARE >   num_var TEXT; > BEGIN >   FOR i IN 1..10 LOOP >     num_var := num_var || ',' || i; >   END LOOP; >   RETURN num_va

[GENERAL] Huge amount of memory errors with libpq

2010-09-11 Thread Casey Jones
I'm writing a server application in C that needs to interact with a postgre database, but on my development server I'm getting tons of memory errors from valgrind. There are enough of them that it's causing problems, like data stored in a char* is magically changing after calling PQexec(). I'm

[GENERAL] Fwd: how to write the sql if i want to find a geometry's d-distance neighbors?

2010-09-11 Thread sunpeng
I can't mail it to: postgis-us...@postgis.refractions.net so could administrator forword this mail to them? thanks! From: sunpeng Date: 2010/9/12 Subject: how to write the sql if i want to find a geometry's d-distance neighbors? To: postgis-us...@postgis.refractions.net Hi, I've the following

Re: [GENERAL] Incrementally Updated Backups

2010-09-11 Thread Bruce Momjian
Gabe Nell wrote: > > That section has been removed from the current 9.0 docs because we are > > unsure it works. > > Hmm. So the only way to make a consistent backup from a standby server > is to shut down the standby first? Or is even that problematic? > > Would it change anything if we are able

Re: [GENERAL] Incrementally Updated Backups

2010-09-11 Thread Gabe Nell
> That section has been removed from the current 9.0 docs because we are > unsure it works. Hmm. So the only way to make a consistent backup from a standby server is to shut down the standby first? Or is even that problematic? Would it change anything if we are able to guarantee that the filesyst

Re: [GENERAL] Incrementally Updated Backups

2010-09-11 Thread Bruce Momjian
Gabe Nell wrote: > Hello, > > I'm interested in the "incrementally updated backups" scenario > described in section 25.6 of the Postgres 9 documentation. I've > configured streaming replication for my warm standby server. > > Step 2 in this procedure is to note?pg_last_xlog_replay_location at > t

[GENERAL] Incrementally Updated Backups

2010-09-11 Thread Gabe Nell
Hello, I'm interested in the "incrementally updated backups" scenario described in section 25.6 of the Postgres 9 documentation. I've configured streaming replication for my warm standby server. Step 2 in this procedure is to note pg_last_xlog_replay_location at the end of the backup. However it

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread John R Pierce
On 09/11/10 12:26 PM, Merlin Moncure wrote: On Fri, Sep 10, 2010 at 11:07 PM, wrote: Using PostgreSQL I can't open a table and do seeks against an index. I could do a select against the database and see if 0 records are returned, but that seems to take more time than doing a seek on an index.

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread Merlin Moncure
On Fri, Sep 10, 2010 at 11:07 PM, wrote: > Using PostgreSQL I can't open a table and do seeks against an index. I > could do a select against the database and see if 0 records are returned, > but that seems to take more time than doing a seek on an index. Is there a > more SQL friendly way of han

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread Darren Duncan
Martin Gainty wrote: -- i usually INSERT the record --then check for PK VIOLATION e.g. IF PK_VIOLATION then UPDATE record is FoxPro still supported??? My understanding is that exception handling carries significant overhead and so doing it within a heavy-iterated loop like this import would p

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-11 Thread Jeff Davis
On Fri, 2010-09-10 at 18:11 -0700, Nick wrote: > I dont mind if the commas are at the beginning and end, im more > concerned about "three,four" staying in one row because its surrounded > by quotes. -Nick It doesn't sound like a regex is the best solution here. Why not write a function in a langua

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread Martin Gainty
Hi Tony -- i usually INSERT the record --then check for PK VIOLATION e.g. IF PK_VIOLATION then UPDATE record is FoxPro still supported??? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist

[GENERAL] Help! pg_dump: Error message from server: ERROR: cache lookup failed for type 19

2010-09-11 Thread 夏武
i use the slony for replication of postgresql database. it work fine some day. After i use the slony command to delete the replication node, pg_dump does not work, the error message is: *pg_dump: schema with OID 73033 does not exist* Then i delete the name space of slony in pg_namespace, and pg_d

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread Alban Hertroys
On 11 Sep 2010, at 12:09, Alban Hertroys wrote: > It would be great to be able to use a WITH statement to lock down a data set > for multiple subsequent operations, something like: > > WITH nonduplicates (key, data1, data2, etc) AS ( > SELECT key, data1, data2, etc FROM staging_table >

Re: [GENERAL] SQL Programming Question

2010-09-11 Thread Alban Hertroys
On 11 Sep 2010, at 6:10, Scott Bailey wrote: > On 09/10/2010 08:07 PM, t...@exquisiteimages.com wrote: >> I have a situation where I receive a file with transactions that have a >> unique key from a vendor. These transactions should only be imported into >> my system once, but the vendor system wi