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

2010-09-12 Thread sunpeng
I can't mail it to: postgis-us...@postgis.refractions.net so could administrator forword this mail to them? thanks! From: sunpeng blueva...@gmail.com 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,

[GENERAL] Huge amount of memory errors with libpq

2010-09-12 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

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

2010-09-12 Thread Nick
Woops, figured it out. Just needed to declare the num_var := ''; On Sep 11, 10:45 pm, Nick nboutel...@gmail.com 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;  

Re: [GENERAL] How to inherit search_path from template

2010-09-12 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

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

2010-09-12 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

[GENERAL] hi, how to let the inserted tuple visible to other backend when current backend hasn't finish?

2010-09-12 Thread sunpeng
hi, These codes are in the postgresql engine, just assume they are in PortalRun() function: //1.create table structure char *relname = test; ... relOid = heap_create_with_catalog(relname, ); CommandCounterIncrement(); ... //2.then i can use SPI_execute to create index on this created table

[GENERAL] Monitoring Object access

2010-09-12 Thread adi hirschtein
Hi, Using the catalog tables, is there any way to correlate session id/user id to which object (i.e. tables, indexes etc) it access and much how disk reads or I/O wait has been done against the objects. in general, I'd like to see which objects are being accessed by which user and the time/amount

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread J. Roeleveld
On Sunday 12 September 2010 00:43:19 Bruce Momjian wrote: 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

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread Martijn van Oosterhout
On Sun, Sep 12, 2010 at 12:18:10PM +0200, J. Roeleveld wrote: How can you ensure the snapshot is in a consistent state if the server is running? If a snapshot is taken between 2 updates in a single transaction, only half of this transaction is included in the snapshot. I would never

[GENERAL] why can't see the updated value after SPI_execute(update ...., false, 1);

2010-09-12 Thread sunpeng
First I use SPI_execute(update bool succ; SPI_connect(); int ret = SPI_execute(update where uid = 1, false, 1);//later will add error processing if (ret == SPI_OK_UPDATE SPI_processed == 1) { succ = true; } SPI_finish(); Then I use SPI_execute(select

Re: [GENERAL] How to inherit search_path from template

2010-09-12 Thread Scott Marlowe
On Thu, Sep 9, 2010 at 7:41 PM, Merlin Moncure mmonc...@gmail.com wrote: On Thu, Sep 9, 2010 at 7:13 AM, Phui Hock phuih...@gmail.com wrote: Hi, How can I create a database template with altered search_path to be inherited by child databases? Say, I created a template named template_a with

Re: [GENERAL] Huge amount of memory errors with libpq

2010-09-12 Thread Craig Ringer
On 09/12/2010 02:53 PM, Casey Jones wrote: My development server was initially running 8.4.4 on Gentoo. I downgraded to 8.1.21 (still on Gentoo) to match my CentOS production server to see if the problems would go away, but they didn't. Thanks for the test case. It's rare - and delightful -

Re: [GENERAL] Monitoring Object access

2010-09-12 Thread Craig Ringer
On 09/12/2010 06:52 PM, adi hirschtein wrote: Hi, Using the catalog tables, is there any way to correlate session id/user id to which object (i.e. tables, indexes etc) it access and much how disk reads or I/O wait has been done against the objects. in general, I'd like to see which objects are

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread J. Roeleveld
On Sunday 12 September 2010 13:32:00 Martijn van Oosterhout wrote: On Sun, Sep 12, 2010 at 12:18:10PM +0200, J. Roeleveld wrote: How can you ensure the snapshot is in a consistent state if the server is running? If a snapshot is taken between 2 updates in a single transaction, only

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread Scott Marlowe
On Sun, Sep 12, 2010 at 7:39 AM, J. Roeleveld jo...@antarean.org wrote: On Sunday 12 September 2010 13:32:00 Martijn van Oosterhout wrote: On Sun, Sep 12, 2010 at 12:18:10PM +0200, J. Roeleveld wrote: How can you ensure the snapshot is in a consistent state if the server is running? If a

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread Bruce Momjian
J. Roeleveld wrote: On Sunday 12 September 2010 13:32:00 Martijn van Oosterhout wrote: On Sun, Sep 12, 2010 at 12:18:10PM +0200, J. Roeleveld wrote: How can you ensure the snapshot is in a consistent state if the server is running? If a snapshot is taken between 2 updates in a

Re: [GENERAL] Incrementally Updated Backups

2010-09-12 Thread Scott Marlowe
On Sun, Sep 12, 2010 at 7:51 AM, Bruce Momjian br...@momjian.us wrote: J. Roeleveld wrote: Nice in theory. Except backups can not be fully trusted if they rely on database recovery mechanics as part of the restore process. How certain can you be that the data you have in your backup will

Re: [GENERAL] Monitoring Object access

2010-09-12 Thread adi hirschtein
Hi Craig, Thanks a lot for the quick response! I'm coming from the Oracle side of the house and In oracle for instance, you use shared buffer as well, but you are still able to see which session is waiting for which blocks and if one session is doing the real I/O then the other one wait on 'wait

Re: [GENERAL] why can't see the updated value after SPI_execute(update ...., false, 1);

2010-09-12 Thread Tom Lane
sunpeng blueva...@gmail.com writes: First I use SPI_execute(update bool succ; SPI_connect(); int ret = SPI_execute(update where uid = 1, false, 1);//later will add error processing if (ret == SPI_OK_UPDATE SPI_processed == 1) { succ = true; }

[GENERAL] pgcrypto pgp_pub_decrypt() fails with secret key password

2010-09-12 Thread Eric Lukather
Hi, I have pgcrypto working fine with gpg keys that do *not* have a passphrase. But, if I try the exact same gpg -a --export commands and application code with gpg keys that are generated *with* a passphrase, then I get the following pgp_pub_decrypt() error within psql: \set pubkey `sed

Re: [GENERAL] Huge amount of memory errors with libpq

2010-09-12 Thread Casey Jones
On Sun, Sep 12, 2010 at 7:54 AM, Craig Ringer cr...@postnewspapers.com.auwrote: Anyway, since you've provided a test program, I can at least run it here on a modern PostgreSQL and see what results I get to provide some more info. In this case, it runs fine and no issues are detected. I'm on a

Re: [GENERAL] why can't see the updated value after SPI_execute(update ...., false, 1);

2010-09-12 Thread sunpeng
I then added , yet it still doesn't work. 2010/9/12 Tom Lane t...@sss.pgh.pa.us sunpeng blueva...@gmail.com writes: First I use SPI_execute(update bool succ; SPI_connect(); int ret = SPI_execute(update where uid = 1, false, 1);//later will add error processing

Re: [GENERAL] Huge amount of memory errors with libpq

2010-09-12 Thread Tom Lane
Casey Jones jonescas...@gmail.com writes: I don't think valgrind is the only issue here because outside valgrind my data is getting magically overwritten. In the function causing that problem I set all the fields I wanted to set by hand instead of using PQgetvalue(). If I leave PQexec()

[GENERAL] Query plan choice issue

2010-09-12 Thread Yaroslav Tykhiy
Hi all, I'm seeing a funny behaviour in Postgresql 8.4.4. Namely, a query can be executed using either of two different query plans, one taking a few milliseconds and the other, tens of seconds. The work_mem setting doesn't seem to affect it -- tried to increase or decrease it by 2 or

Re: [GENERAL] Query plan choice issue

2010-09-12 Thread Martin Gainty
a cursory look of the plan details a FTS on dbmail_headername invoked by the JOIN clause JOIN dbmail_headername n ON v.headername_id=n.id you would accelerate the seek appreciably by placing indexes on both participating columns v.headername_id n.id I also see a FTS on domain_headervalue

[GENERAL] Schema search path

2010-09-12 Thread Yaroslav Tykhiy
Hi there, Sorry but I've got yet another issue to discuss today, this time that on schema search path. In fact it may not be a bug, but it may be worth a note in the documentation. It seems that if the table in SELECT FROM has an explicit schema specifier, further references to the same

Re: [GENERAL] Monitoring Object access

2010-09-12 Thread Craig Ringer
On 09/12/2010 10:02 PM, adi hirschtein wrote: Hi Craig, Thanks a lot for the quick response! I'm coming from the Oracle side of the house and In oracle for instance, you use shared buffer as well, but you are still able to see which session is waiting for which blocks and if one session is

[GENERAL] JSON output

2010-09-12 Thread Dennis Gearon
I'm trying to import from a postgres database (which will work in parallel) to a ElasticSearch databse (JSON input). Is there anyway to get JSON output from postgres? (googled, found only 'planner' output does this) Dennis Gearon Signature Warning EARTH has a Right To Life,

[GENERAL] Change the UI language of psql connection

2010-09-12 Thread Brodie Thiesfield
I have a PostgreSQL 8.4 database, installed with Japanese as the main language. I am connecting from an English Windows 7 client using psql.exe. Is there any way to change the UI of the messages shown to me (e.g. the help, column headers from the \l command, etc) to English? I know that I can set

Re: [GENERAL] Change the UI language of psql connection

2010-09-12 Thread Tom Lane
Brodie Thiesfield brofi...@gmail.com writes: I have a PostgreSQL 8.4 database, installed with Japanese as the main language. I am connecting from an English Windows 7 client using psql.exe. Is there any way to change the UI of the messages shown to me (e.g. the help, column headers from the \l

Re: [GENERAL] JSON output

2010-09-12 Thread Craig Ringer
On 13/09/10 10:36, Dennis Gearon wrote: I'm trying to import from a postgres database (which will work in parallel) to a ElasticSearch databse (JSON input). Is there anyway to get JSON output from postgres? Not out of the box. The closest you'll get, AFAIK, is XML output from the SQLXML

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

2010-09-12 Thread Craig Ringer
On 11/09/10 14:21, 夏武 wrote: 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

Re: [GENERAL] Change the UI language of psql connection

2010-09-12 Thread Brodie Thiesfield
On Mon, Sep 13, 2010 at 12:33 PM, Tom Lane t...@sss.pgh.pa.us wrote: Brodie Thiesfield brofi...@gmail.com writes: I have a PostgreSQL 8.4 database, installed with Japanese as the main language. I am connecting from an English Windows 7 client using psql.exe. Is there any way to change the UI

Re: [GENERAL] Huge amount of memory errors with libpq

2010-09-12 Thread Casey Jones
On Sunday 12 September 2010 5:44:26 pm you wrote: Casey Jones jonescas...@gmail.com writes: I don't think valgrind is the only issue here because outside valgrind my data is getting magically overwritten. In the function causing that problem I set all the fields I wanted to set by hand