Re: Removing spaces - Mailing list pgsql-general

From Fabrizio Mazzoni
Subject Re: Removing spaces
Date
Msg-id 20030220194244.7cede80e.veramente@libero.it
Whole thread Raw
In response to Removing spaces  (Dave Smith <dave.smith@candata.com>)
List pgsql-general
You could use the trim function in a plpgsql trigger function eg:

CREATE FUNCTION fn_tr_longpad() RETURNS trigger AS '
begin
NEW.a := trim(trailing '' '' from NEW.a);
return NEW;
end; '  LANGUAGE 'plpgsql';

CREATE TRIGGER tst_trigger BEFORE INSERT ON mytable FOR EACH ROW EXECUTE PROCEDURE fn_tr_longpad()

a is the name of the column you have to trim, change it to your needs

Regards,

Fabrizio Mazzoni

pgsql-general by date:

Previous
From: Dennis Gearon
Date:
Subject: Re: Table Partitioning in Postgres:
Next
From: Dan Delaney
Date:
Subject: Dealing with schema in psql utility?