Re: [GENERAL] sql insert function

2004-01-13 Thread Richard Huxton
On Tuesday 13 January 2004 17:46, Chris Ochs wrote: > Yes it was in my function. I thought the docs said that BEGIN and END had > no effect on transactions though? Plus wouldn't there have to be a > transaction active since I was not using autocommit and the inserts did in > fact commit? > > I su

Re: [GENERAL] sql insert function

2004-01-13 Thread Chris Ochs
ll take it out and see what happens. - Original Message - From: "Stephan Szabo" <[EMAIL PROTECTED]> To: "Chris Ochs" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, January 13, 2004 8:36 AM Subject: Re: [GENERAL] sql insert function >

Re: [GENERAL] sql insert function

2004-01-12 Thread Chris Ochs
My function does not call commit, and I have autocommit turned off. In the postgresql server logs it looks like this without using the function: LOG: statement: begin LOG: statement: insert into... LOG: statement: insert into... LOG: statement: insert into... LOG:: statement: commit LOG: sta

Re: [GENERAL] sql insert function

2004-01-12 Thread Alex Satrapa
Chris Ochs wrote: My program starts a transaction, does about 20 inserts, then commits. When I replace once of the inserts with a function that does the insert, when I do the commit I get this message: WARNING: there is no transaction in progress The inserts all commit fine. Do functions used t

Re: [GENERAL] sql insert function

2004-01-12 Thread Chris Ochs
I am seeing another strange thing when using a function that does an insert instead of doing the insert directly. This is using cached connections with apache/mod_perl. My program starts a transaction, does about 20 inserts, then commits. When I replace once of the inserts with a function that d

Re: [GENERAL] sql insert function

2004-01-12 Thread Chris Ochs
Hmmm since the function already knows the type, the quotes aren't needed. If you use them it just inserts a literal $1 and $3. - Original Message - From: "Alex Satrapa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 12, 2004 4:33 PM Subjec

Re: [GENERAL] sql insert function

2004-01-12 Thread Richard Welty
On Mon, 12 Jan 2004 16:21:17 -0800 Chris Ochs <[EMAIL PROTECTED]> wrote: > The documentation doesn't have any examples of using an sql language > function to do an insert, andI am at loss as to I am doing wrong here. > The error I get trying to create the function is: ERROR: syntax error at > or

Re: [GENERAL] sql insert function

2004-01-12 Thread Doug McNaught
"Chris Ochs" <[EMAIL PROTECTED]> writes: > The documentation doesn't have any examples of using an sql language > function to do an insert, andI am at loss as to I am doing wrong here. > The error I get trying to create the function is: ERROR: syntax error at > or near "$1" at character 148 > >

Re: [GENERAL] sql insert function

2004-01-12 Thread Alex Satrapa
Chris Ochs wrote: Never mind, I forgot to quote the quote's... Heh... and here I was thinking you were trying to build a function ;) And I made the same mistake as you... guess I should proofread instead of copy-pasting ;) Alex Satrapa ---(end of broadcast)--

Re: [GENERAL] sql insert function

2004-01-12 Thread Alex Satrapa
Chris Ochs wrote: CREATE FUNCTION taxship(varchar,integer,varchar,float,float) returns integer AS ' insert into taxship(s_oid,order_id,mer_id,tax,shipping) values ('$1',$2,'$3',$4,$5); SELECT 1; ' LANGUAGE SQL; try CREATE FUNCTION taxship (varchar,integer,varchar,float,float) RETURNS integer AS '