Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-08 Thread Rod Taylor
On Mon, 2003-09-08 at 09:44, Jomon Skariah wrote: > Hi, > > Do we have any replacement for REPLACE() of Oracle in PostGres? What does replace() do? String replacement? http://www.postgresql.org/docs/7.3/interactive/functions-string.html replace(string text, from text, to text) signature.asc

[SQL] undefine currval()

2003-09-08 Thread Chris Gamache
I'm using sequences and currval() to retrieve the last inserted row in a table. If currval() is undefined, as it is when a connection is made, then I know no rows were inserted in that table and can take a different action. This is problematic when using a connection pooling library, as the value

Re: [SQL] undefine currval()

2003-09-08 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > One (theoretical) workaround would be to issue some sort of command to the > back-end database to wipe all values of currval() when a "new" connection is > made. I've done some digging in the system tables and source code, and can't > find an obvious solu

Re: [SQL] undefine currval()

2003-09-08 Thread Bruce Momjian
Chris Gamache wrote: > I'm using sequences and currval() to retrieve the last inserted row in a table. > > > If currval() is undefined, as it is when a connection is made, then I know no > rows were inserted in that table and can take a different action. This is > problematic when using a connect

Re: [SQL] undefine currval()

2003-09-08 Thread scott.marlowe
On Mon, 8 Sep 2003, Bruce Momjian wrote: > I don't know how you could have an application that doesn't know if it > has issued a nextval() in the current connection. Unless you can explain > that, we have no intention of playing tricks with currval() for > connection pooling. Actually, I would th

Re: [SQL] undefine currval()

2003-09-08 Thread Tom Lane
"scott.marlowe" <[EMAIL PROTECTED]> writes: > On Mon, 8 Sep 2003, Bruce Momjian wrote: >> I don't know how you could have an application that doesn't know if it >> has issued a nextval() in the current connection. Unless you can explain >> that, we have no intention of playing tricks with currval()

Re: [SQL] undefine currval()

2003-09-08 Thread Achilleus Mantzios
On Mon, 8 Sep 2003, Chris Gamache wrote: > I'm using sequences and currval() to retrieve the last inserted row in a table. > > > If currval() is undefined, as it is when a connection is made, then I know no > rows were inserted in that table and can take a different action. This is > problematic

[SQL] plpgsql doesn't coerce boolean expressions to boolean

2003-09-08 Thread Tom Lane
Following up this gripe http://archives.postgresql.org/pgsql-sql/2003-09/msg00044.php I've realized that plpgsql just assumes that the test expression of an IF, WHILE, or EXIT statement is a boolean expression. It doesn't take any measures to ensure this is the case or convert the value if it's no

Re: [SQL] [GENERAL] plPGSQL bug in function creation

2003-09-08 Thread Richard Huxton
On Monday 08 September 2003 09:32, Marek Lewczuk wrote: > Hello, > I think that there is a bug in plPGSQL - or maybe I don't know something > about this language. Try to create this function [snip] > And when i execute: SELECT test(NULL, 'buuu'); -> it returns me NULL > value, when it should return

Re: [SQL] [GENERAL] plPGSQL bug in function creation

2003-09-08 Thread George Weaver
I had the same success using 7.3.2 with Cygwin: e=# SELECT functest1('A','B'), functest1(null,'B'), functest2('A','B'), functest2(null,'B'); functest1 | functest1 | functest2 | functest2 ---+---+---+--- A | B | A | B (1 row) e=# select ve

Re: [SQL] plPGSQL bug in function creation

2003-09-08 Thread Tom Lane
"Marek Lewczuk" <[EMAIL PROTECTED]> writes: > CREATE FUNCTION "public"."test" (text, text) RETURNS text AS' > BEGIN > IF $1 THEN > RETURN $1; > ELSE > RETURN $2; > END IF; > END; > 'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; If there's a bug here at all, it's

[SQL] plPGSQL bug in function creation

2003-09-08 Thread Marek Lewczuk
Hello, I think that there is a bug in plPGSQL - or maybe I don't know something about this language. Try to create this function Ok., this is the function created in plPGSQL: CREATE FUNCTION "public"."test" (text, text) RETURNS text AS' BEGIN IF $1 THEN RETURN $1; ELSE RETURN $2; E