Skip site navigation (1) Skip section navigation (2)

need trigger help

From: "Mag Gam" <magawake(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: need trigger help
Date: 2007-11-20 15:59:19
Message-ID: 1cbd6f830711200759s75747c82ud3fbad7f67c23432@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi All,

I need some trigger help. I am very new to SQL, so please bare with me.

I have a table:

CREATE TABLE table (
    id integer,
    name text,
);

Basically, I have values going into name.

The values that go into name are like this (being generated by a script),
without the quotes:
"    name1"
"name2"
"  name3"
"    name4"
"name5   "

I want to write a trigger, for UPDATE/INSERT, do a ltrim and rtrim() of name
value. I want to remove all the beginning and ending blank spaces.

I want name to be like this:
"name1"
"name2"
"name3"
"name4"
"name5"


Is that possible?

TIA

Responses

pgsql-novice by date

Next:From: Rodrigo De LeónDate: 2007-11-20 16:19:09
Subject: Re: need trigger help
Previous:From: Emil Oppeln-BronikowskiDate: 2007-11-20 07:08:27
Subject: Re: Database version control

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group