Re: [SQL] How can I optimize this query

2003-09-09 Thread Bruno Wolff III
On Tue, Sep 09, 2003 at 13:39:10 +0530, Jainendra Kumar P <[EMAIL PROTECTED]> wrote: > I have the following query > > UPDATE accumulator1 SET accumulator1.status = "User Excluded" > WHERE accumulator1.name NOT IN > (SELECT DISTINCT accumulator1.name > FROM accumulator1, diaaffectedstmts > WHER

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Jan Wieck
Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: ERROR is the cleanest way, but I'd vote for conversion to boolean to keep the damage within reason. Which style of conversion did you like? These were the choices: 3. Try to convert nonbooleans to boolean using plpgsql's usual method for cr

Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-09 Thread Jomon Skariah
Hi, Thanx for your reply. The problem is we are using PostGres 7.1.In this version REPLACE() is not available. Regards Jomon -Original Message- From: Rod Taylor [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 7:41 PM To: Jomon Skariah Cc: Kris Jurka; [EMAIL PROTECTED

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Andrew Dunstan
Tom Lane wrote: 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

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

2003-09-09 Thread Dennis Gearon
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 Ok., this is the function created in plPGSQL: CREATE FUNCTION "public"."test" (text, text) RETURNS text AS' BEGIN IF $1 THEN RETURN $1; ELSE

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

2003-09-09 Thread R. van Twisk
I would suggest to throw a error, or at least a warning. This will FORCE people to program in the correct way. I also thought that 'IF $1 THEN ...' should work ok but giving it a other thought it's indeed stuped to write that way (I'm from the C world...) Ries -Oorspronkelijk bericht- V

Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-09 Thread Jomon Skariah
Hi, Do we have any replacement for REPLACE() of Oracle in PostGres? I know we can function to do same job. Regards Jomon -Original Message- From: Kris Jurka [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 1:52 PM To: Rod Taylor Cc: Jomon Skariah; [EMAIL PROTECTED] Subje

Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-09 Thread Kris Jurka
On Thu, 4 Sep 2003, Rod Taylor wrote: > > 2 Also I need to find an alternative for ROWNUM in oracle.. > > If you are looking for a unique identifier, try using the OID. > ROWID is oracle's unique identifier, ROWNUM is the row number in a query result. In the past it has been suggested that R

[SQL] How can I optimize this query

2003-09-09 Thread Jainendra Kumar P
I have the following query UPDATE accumulator1 SET accumulator1.status = "User Excluded" WHERE accumulator1.name NOT IN (SELECT DISTINCT accumulator1.name FROM accumulator1, diaaffectedstmts WHERE diaaffectedstmts.stmt like '*'+ accumulator1.name +'*' and diaaffectedstmts.xref_type <> "D");

[SQL] Test, please ignore

2003-09-09 Thread Roberto João Lopes Garcia
Just a teste, please ignore ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [HACKERS] [SQL] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Bruce Momjian
Tom Lane wrote: > Manfred Koizar <[EMAIL PROTECTED]> writes: > > On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]> > > wrote: > >> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans > >> will be accepted in exactly the same cases where they'd be accepted > >> in a b

[SQL] contrib/ltree

2003-09-09 Thread floyds
how do i get jdbc to recognize the ltree type that comes with the contrib/ltree extension? This: Object object = resultSet.getObject(columnNumber); generates the following exception: Exception caused by: No class found for ltree at org.postgresql.jdbc1.AbstractJdbc1Connection.getOb

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > ERROR is the cleanest way, but I'd vote for conversion to boolean to > keep the damage within reason. Which style of conversion did you like? These were the choices: >> 3. Try to convert nonbooleans to boolean using plpgsql's usual method >> for cross-typ

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Jan Wieck
Tom Lane wrote: 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 t

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

2003-09-09 Thread Richard Hall
Define the language! If it breaks code, so be it. 2. Throw an error if the _expression_ doesn't return boolean. Yes, yes, absolutely. By definition "an IF, WHILE, or EXIT statement is a boolean _expression_" SO     if "some stupid piece of text" THEN should not compile, there is no BOOLEAN _expre

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

2003-09-09 Thread Tom Lane
Manfred Koizar <[EMAIL PROTECTED]> writes: > On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]> > wrote: >> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans >> will be accepted in exactly the same cases where they'd be accepted >> in a boolean-requiring SQL constru

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

2003-09-09 Thread Manfred Koizar
On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: >4. Use the parser's coerce_to_boolean procedure, so that nonbooleans > will be accepted in exactly the same cases where they'd be accepted > in a boolean-requiring SQL construct (such as CASE). (By default, > none are,

Re: [SQL] undefine currval()

2003-09-09 Thread scott.marlowe
On Mon, 8 Sep 2003, Tom Lane wrote: > "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 hav

Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-09 Thread Rod Taylor
> The problem is we are using PostGres 7.1.In this version REPLACE() is not > available. It sounded like you were just starting to work on the change over. I highly suggest upgrading to 7.3 at the very least, 7.4 if you're going to be a few months prior to going to production. A ton of good work

Re: [SQL] Conversion from Sybase ASA

2003-09-09 Thread Ian Barwick
On Tuesday 09 September 2003 09:06, Richard Sydney-Smith wrote: > In sybase I can use the following syntax: > > select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans > > this returns two columns: src = 'T' and pres which has e

Re: [SQL] Conversion from Sybase ASA

2003-09-09 Thread Viorel Dragomir
select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans   select 'T' as src,(CASE WHEN tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' THEN  'U' ELSE  'P' END) as pres from ftrans   I think it works in Oracle too

[SQL] Conversion from Sybase ASA

2003-09-09 Thread Richard Sydney-Smith
In sybase I can use the following syntax:   select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans this returns two columns: src = '' and pres which has either the value 'U' or 'P' how would I express this in postgresql