Re: [GENERAL] Help with Trigger

2016-12-28 Thread Clifford Snow
Thank you for your suggestion which solved the problem. Much better solution that what I was trying to accomplish. Much smaller table to query since it only has one entry per user. Clifford On Wed, Dec 28, 2016 at 8:12 PM, Adrian Klaver wrote: > On 12/28/2016 07:06

Re: [GENERAL] Help with Trigger

2016-12-28 Thread Adrian Klaver
On 12/28/2016 07:06 PM, Clifford Snow wrote: I'm trying to write a trigger (my first) to update another table if the user_id is new. But I'm getting a index exception that the user_id What is the actual error message? already exists. I'm picking up data from another feed which gives provides

[GENERAL] Help with Trigger

2016-12-28 Thread Clifford Snow
I'm trying to write a trigger (my first) to update another table if the user_id is new. But I'm getting a index exception that the user_id already exists. I'm picking up data from another feed which gives provides me with changes to the main database. what I have is CREATE OR REPLACE FUNCTION

Re: [GENERAL] Help with trigger

2010-12-27 Thread Gary Chambers
Michael, I'm new to PostgreSQL, but have worked with other databases. I'm trying to write a trigger to default a timestamp column to a fixed interval before another. The test setup is as follows: create table test ( date1 timestamp, date2 timestamp ); create or replace function

Re: [GENERAL] Help with trigger

2010-12-27 Thread Guillaume Lelarge
Le 27/12/2010 18:57, Michael Satterwhite a écrit : I'm new to PostgreSQL, but have worked with other databases. I'm trying to write a trigger to default a timestamp column to a fixed interval before another. The test setup is as follows: create table test ( date1 timestamp,

Re: [GENERAL] Help with trigger

2010-12-27 Thread Richard Broersma
On Mon, Dec 27, 2010 at 9:57 AM, Michael Satterwhite mich...@weblore.com wrote: CREATE TRIGGER t_listing_startdate before insert or update on test        for each row execute procedure t_listing_startdate(); Now that you've created a trigger function, you need to attached to your table:

Re: [GENERAL] Help with trigger

2010-12-27 Thread Richard Broersma
On Mon, Dec 27, 2010 at 1:14 PM, Michael Satterwhite mich...@weblore.com wrote: I've *GOT* to be missing something in this post. You start by quoting the Create Trigger that attaches the trigger to the table. Then you tell me that I've got to do what you showed that I did. Oops, your right,

Re: [GENERAL] Help with trigger

2010-12-27 Thread Gary Chambers
Michael, I'm new to PostgreSQL, but have worked with other databases. I'm trying to write a trigger to default a timestamp column to a fixed interval before another. The test setup is as follows: Try this pg_dump of a working example: CREATE FUNCTION t_listing_startdate() RETURNS trigger

Re: [GENERAL] Help with trigger

2010-12-27 Thread Guillaume Lelarge
Le 27/12/2010 22:16, Michael Satterwhite a écrit : On Monday, December 27, 2010 12:58:40 pm Guillaume Lelarge wrote: Le 27/12/2010 18:57, Michael Satterwhite a écrit : I'm new to PostgreSQL, but have worked with other databases. I'm trying to write a trigger to default a timestamp column to a

Re: [GENERAL] Help with trigger

2010-12-27 Thread Tom Lane
Michael Satterwhite mich...@weblore.com writes: On Monday, December 27, 2010 12:58:40 pm Guillaume Lelarge wrote: Le 27/12/2010 18:57, Michael Satterwhite a écrit : I'm obviously missing something ... and probably something obvious. Why is date2 still null? I'm not sure it'll help you. I

Re: [GENERAL] help with trigger

2004-08-27 Thread Dino Vliet
Maybe I've missed it but can someone plese help me with this? Brgds and thanks in advance, --- Dino Vliet [EMAIL PROTECTED] wrote: Hi folks, I'm new to PostgreSQL and am busy tring to work with it. Of pl/pgsql I know even less and that's the part I have a question on right now. I have this

[GENERAL] help with trigger

2004-08-25 Thread Dino Vliet
Hi folks, I'm new to PostgreSQL and am busy tring to work with it. Of pl/pgsql I know even less and that's the part I have a question on right now. I have this nice example to get me started with pl/pgsql... I have a table with the schedule of a service my sport team wants to offer: Table