Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread David Fetter
On Mon, Feb 23, 2009 at 09:39:01AM -0800, SHARMILA JOTHIRAJAH wrote: > Hi, > This is a simple function that returns a boolean .. This should be an SQL function, as it doesn't do anything you need (or would even find convenient) for a more procedural language to do: CREATE OR REPLACE FUNCTION chec

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Richard Broersma
On Mon, Feb 23, 2009 at 9:39 AM, SHARMILA JOTHIRAJAH wrote: >IF ( newValue != oldValue) One good piece of advice that Tom Lane pointed out to me was: IF ( newValue IS DISTINCT FROM oldValue ) is better due to (what may be) the unexpected results of equality testing when NULL values are thr

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Adrian Klaver
- "SHARMILA JOTHIRAJAH" wrote: > Hi, > This is a simple function that returns a boolean .. > > create or replace function check_value( newValue IN VARCHAR, > oldValue IN VARCHAR ) RETURN BOOLEAN ^^ RETURNS > as > ' > BEGIN

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread Tom Lane
SHARMILA JOTHIRAJAH writes: > create or replace function check_value( newValue IN VARCHAR, > oldValue IN VARCHAR ) RETURN BOOLEAN Should be RETURNS BOOLEAN. You might want to fix whatever client code you are using so that it shows the error cursor, which would certainly have

Re: [GENERAL] Function that returns Boolean

2009-02-23 Thread SHARMILA JOTHIRAJAH
Its a typo..it should be "RETURNS BOOLEAN" and not "RETURN BOOLEAN" -Sharmila --- On Mon, 2/23/09, SHARMILA JOTHIRAJAH wrote: > From: SHARMILA JOTHIRAJAH > Subject: Function that returns Boolean > To: "General postgres mailing list" > Date: Monday, February 23, 2009, 12:39 PM > Hi, > This is

[GENERAL] Function that returns Boolean

2009-02-23 Thread SHARMILA JOTHIRAJAH
Hi, This is a simple function that returns a boolean .. create or replace function check_value( newValue IN VARCHAR, oldValue IN VARCHAR ) RETURN BOOLEAN as ' BEGIN IF ( newValue != oldValue) then return true; else return false; END IF; END; ' LANGU