[GENERAL] Syntax error in spi_prepare usage

2010-04-24 Thread dipti shah
I am using SPI_Prepare from trigger like below. I have some minor issue with $query syntax. I have tried almost all combination but I am not able to resolve. Could anyone please help me out. CREATE OR REPLACE FUNCTION insert_history_info() RETURNS VOID AS $BODY$ my $query = (< there is some issue

[GENERAL] Catch exception from plpy

2010-04-24 Thread dario....@libero.it
Hello, Could someone show me how to catch exceptions generated by plpy.execute()? >From the documentation and other posts I understand that you need to call plpy. error() but I still cannot figure out how to use it. For example, say I need a function that creates table foo if it doesn't exists,

Re: [GENERAL] Catch exception from plpy

2010-04-24 Thread Martin Gainty
use try with exception e.g. create or replace function test_tryex() returns void AS ' try: plpy.execute('create table tmp_foo (v1 int); plpy.execute('select * from tmp_foo); except Exception, ex: plpy.notice("FUBAR!-- %s" % str(ex)) return "FUBAR!" return "test_tryex function has

[GENERAL] How to allow PostgreSQL to accept remote connection?

2010-04-24 Thread Andre Lopes
Hi, I have a virtual machine with VMWARE, and I need to connect from outside the virtual machine to PostgreSQL. How can I configure the PostgreSQL to accept outside connections? Best Regards,

Re: [GENERAL] How to allow PostgreSQL to accept remote connection?

2010-04-24 Thread Raymond O'Donnell
On 24/04/2010 15:58, Andre Lopes wrote: > Hi, > > I have a virtual machine with VMWARE, and I need to connect from outside > the virtual machine to PostgreSQL. > > How can I configure the PostgreSQL to accept outside connections? It should be just the same as a "real" machine put the IP addr

Re: [GENERAL] How to allow PostgreSQL to accept remote connection?

2010-04-24 Thread Andre Lopes
Thanks for the reply's, How can I configure pg_hba.conf to accept connections from all IP's What I have in this file is: #ipv4 host all all 127.0.0.1/32 md5 #ipv6 host all all ::1/128 md5 What I need to change? Best Regards, On Sat, Apr 24, 2010 at 4:15 PM, Fredric Fredricson < fredric.fre

[GENERAL] ISP provider with postgres and perl dbi

2010-04-24 Thread John Gage
I know this is perhaps an inappropriate question (and to some extent I am repeating myself), but I now need to get my website up and running. Would anyone be willing to suggest an ISP that offers virtual machines running postgres and perl 5.8.8 or above with perl dbi? The ideal candidate w

Re: [GENERAL] ISP provider with postgres and perl dbi

2010-04-24 Thread Steve Atkins
On Apr 24, 2010, at 8:40 AM, John Gage wrote: > I know this is perhaps an inappropriate question (and to some extent I am > repeating myself), but I now need to get my website up and running. > > Would anyone be willing to suggest an ISP that offers virtual machines > running postgres and perl

Re: [GENERAL] Syntax error in spi_prepare usage

2010-04-24 Thread Alban Hertroys
> If I remove the braces from (\$1, \$2, \$3) then it gives below error. > > my $query = (< INSERT INTO changelogtest(id, txid, txtime) > SELECT \$1, \$2, \$3 > EXCEPT > SELECT (id, txid, txtime) > FROM changelogtest > WHERE id = \$1 > AND txid = \$2 > AND txtime = \$3; > ENDQUE

Re: [GENERAL] Invalid objects

2010-04-24 Thread Oliver Kohll - Mailing Lists
Scott, I implemented a system exactly like this for the app in my signature below. Basically the system stores metadata containing each view definition and the joins between them. When someone needs to alter a view, say to remove a column, a DROP CASCADE is performed then each view is recreated

[GENERAL] Lock table, best option?

2010-04-24 Thread Andre Lopes
Hi, I need to do a SELECT and an UPDATE, but I will have concurrent processes doing the same task. How can I prevent that the concurrent task don't have the same results in the SELECT? Locking a table? How can I do that? Best Regards,

[GENERAL] Help me stop postgres from crashing.

2010-04-24 Thread Sam
Hi, I am a web developer, I've been using postgesql for a few years but administratively I am a novice. A particular web application I am working has a staging version running one a vps, and a production version running on another vps. They both get about the same usage, but the production versio

Re: [GENERAL] Help me stop postgres from crashing.

2010-04-24 Thread Thom Brown
On 24 April 2010 18:48, Sam wrote: > Hi, > > I am a web developer, I've been using postgesql for a few years but > administratively I am a novice. > > A particular web application I am working has a staging version > running one a vps, and a production version running on another vps. > They both

Re: [GENERAL] How to allow PostgreSQL to accept remote connection?

2010-04-24 Thread Fredric Fredricson
Andre Lopes wrote: Thanks for the reply's, How can I configure pg_hba.conf to accept connections from all IP's What I have in this file is: #ipv4|host all all 127.0.0.1/32 md5 #ipv6 ||host all all ::1/128 md5| What I need to change? ||According to http://www.postgresql.

Re: [GENERAL] Help me stop postgres from crashing.

2010-04-24 Thread Tom Lane
Sam writes: > A particular web application I am working has a staging version > running one a vps, and a production version running on another vps. > They both get about the same usage, but the production version keeps > crashing and has to be re-started daily for the last couple days. The > log

Re: [GENERAL] Identical command-line command will not work with \i metacommand and filename

2010-04-24 Thread Bruce Momjian
John Gage wrote: > > http://en.wikipedia.org/wiki/Byte_order_mark > > > > Tends to get added if you go through a Windows system. Useless for > > utf-8 afaik. Confuse the hell out of you because various tools parse > > and hide them then you pipe the file to a script and everything > > falls o

[GENERAL] Problem compiling function with BEGIN WORK; COMMIT WORK;

2010-04-24 Thread Andre Lopes
Hi, I need to use the BEGIN WORK; and COMMIT WORK; to lock a table when I'am doing a SELECT and UPDATE operation. The code is not compiling, the error is: [error]ERROR: syntax error at or near "work" at character 1 QUERY: work CONTEXT: SQL statement in PL/PgSQL function "apr_apanhar_ownership

Re: [GENERAL] how to set CACHEDEBUG ?

2010-04-24 Thread Bruce Momjian
sunpeng wrote: > I noticed there is a piece of code: > #ifdef CACHEDEBUG > #define InitCatCache_DEBUG2 \ > do { \ > elog(... > } while(0) > #else > #define InitCatCache_DEBUG2 > #endif > > Now I'd like to set CACHEDEBUG, how to set up it ? where ? > thanks You compile with that flag, like

Re: [GENERAL] Problem compiling function with BEGIN WORK; COMMIT WORK;

2010-04-24 Thread Craig Ringer
On 25/04/2010 9:07 AM, Andre Lopes wrote: Hi, I need to use the BEGIN WORK; and COMMIT WORK; to lock a table when I'am doing a SELECT and UPDATE operation. PostgreSQL's server-side functions do *not* support transaction management. They're functions that're used inside an existing transaction

Re: [GENERAL] ISP provider with postgres and perl dbi

2010-04-24 Thread John Gage
Thank you for your reply and the reference. Excellent. On Apr 24, 2010, at 5:55 PM, Steve Atkins wrote: On Apr 24, 2010, at 8:40 AM, John Gage wrote: I know this is perhaps an inappropriate question (and to some extent I am repeating myself), but I now need to get my website up and runni