Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Tom Lane
"Plugge, Joe R." writes: > This is what I have and it seems to work: > IF OLD.password != NEW.password It'd be better to write "IF OLD.password IS DISTINCT FROM NEW.password". The way with != will not do what you want if one value is null and the other isn't. It's possible this does

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
This is what I have and it seems to work: CREATE OR REPLACE FUNCTION holly_unlock() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF OLD.password != NEW.password THEN UPDATE hms_mtusers_rw set loginfailedcount = 0 WHERE userid = OLD.userid and owner

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Justin Graf
On 5/6/2010 4:12 PM, Plugge, Joe R. wrote: > > I am trying to create a update trigger on a table that basically will > only fire when a specific column is updated. I am using version 8.4.3. > > My plan of attack was to always fire on any row update, and pass in > the OLD and NEW column that I wa

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
Nevermind all, I figured it out Thanks Dmitriy ... From: Dmitriy Igrishin [mailto:dmit...@gmail.com] Sent: Thursday, May 06, 2010 3:25 PM To: Plugge, Joe R. Subject: Re: [SQL] Column Specific Update Trigger Routine Hey Plugge, You dont need to pass OLD.* or NEW.* to the trigger function. T

[SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
I am trying to create a update trigger on a table that basically will only fire when a specific column is updated. I am using version 8.4.3. My plan of attack was to always fire on any row update, and pass in the OLD and NEW column that I want to check. CREATE TRIGGER check_lockout AFTER U

Re: [SQL] Need a help in regexp

2010-05-06 Thread Leif Biberg Kristensen
On Thursday 6. May 2010 16.48.26 Nicholas I wrote: > Hi, > > Need a help in regexp! > > I have a table in which the data's are entered like, > > Example: > > One (1) > Two (2) > Three (3) > > I want to extract the data which is only within the parentheses. > > that is > 1 > 2 > 3 > > i have

Re: [SQL] Need a help in regexp

2010-05-06 Thread A. Kretschmer
In response to Nicholas I : > Hi, > > Need a help in regexp! > > I have a table in which the data's are entered like, > > Example: > > One (1) > Two (2) > Three (3) > > I want to extract the data which is only within the parentheses. > > that is > 1 > 2 > 3 > > i have written a query, > sele

[SQL] Need a help in regexp

2010-05-06 Thread Nicholas I
Hi, Need a help in regexp! I have a table in which the data's are entered like, Example: One (1) Two (2) Three (3) I want to extract the data which is only within the parentheses. that is 1 2 3 i have written a query, *select regexp_matches(name,'([^(]+)([)]+)','g') from table;* which output

Re: [SQL] How to get localized to_char(DATE) output

2010-05-06 Thread Thomas Kellerer
Tom Lane, 06.05.2010 16:22: Looks like "locale -a" does it on linux, that may be worth a try. Thanks for the answer. Is there a way to get this information from within a SQL statement? No. Postgres doesn't know anything about that. "locale -a" should work on pretty much any Unix-ish syste

Re: [SQL] How to get localized to_char(DATE) output

2010-05-06 Thread Tom Lane
Thomas Kellerer writes: > Jasen Betts, 06.05.2010 11:57: >>> Is there a way to get a list of allowed values for lc_time for a specific >>> installation? >> Looks like "locale -a" does it on linux, that may be worth a try. > Thanks for the answer. Is there a way to get this information from with

Re: [SQL] How to get localized to_char(DATE) output

2010-05-06 Thread Thomas Kellerer
Jasen Betts, 06.05.2010 11:57: The manual says the value for lc_time is OS dependent and indeed "set lc_time = 'German'" does not work on Solaris. Is there a way to get a list of allowed values for lc_time for a specific installation? "man -k locale" would be my starting point (for anything

Re: [SQL] How to get localized to_char(DATE) output

2010-05-06 Thread Jasen Betts
On 2010-05-06, Thomas Kellerer wrote: > Tom Lane, 06.05.2010 00:51: >> Thomas Kellerer writes: >>> I'm trying to get the output of the to_char(date, text) method in German >>> but I can't get it to work: >> >> I think you need 'TMMon' to get a localized month name. >> >> reg