Heh, it's me spamming you again :)
now -- asking for comments.
> > create trigger fsl_update instead of insert or update on fsl ...
> >
> > but till now did not succeed in it. Quick googlink did not help either.
>
> Argh. My google-fu is definitely low in the night ;)
>
> for the record: it'
On Wed, 4 Sep 2013, Dmitry Morozovsky wrote:
> Dear colleagues,
>
> I'm running Pg 9.1 and have schema like the following:
[snip]
> I understand I should use smth like
>
> create trigger fsl_update instead of insert or update on fsl ...
>
> but till now did not succeed in it. Quick googlink
Dear colleagues,
I'm running Pg 9.1 and have schema like the following:
create table machines (
mid serial not null primary key,
mname text not null unique
);
create table fs (
fsidserial not null primary key,
mid int not null references machines,
On 2012-10-19, Victor Sterpu wrote:
> I have this trigger that works fine. The trigger prevents the deletion
> of the last record.
> But I want skip this trigger execution when the delete is done from a
> external key.
> How can I do this?
perhaps you have to use a rule instead of a trigger?
-
> -Original Message-
> From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
> ow...@postgresql.org] On Behalf Of Victor Sterpu
> Sent: Friday, October 19, 2012 2:15 PM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Trigger triggered from a foreign key
>
>
I have this trigger that works fine. The trigger prevents the deletion
of the last record.
But I want skip this trigger execution when the delete is done from a
external key.
How can I do this?
This is the fk
ALTER TABLE focgdepartment
ADD CONSTRAINT fk_focgdep_idfocg FOREIGN KEY (idfocg)
I wrote a trigger function to convert inserts into updates if the
record exists already.
- I am not using rules because the table is populated via COPY.
- I am employing a two-stage process (PERFORM, then UPDATE) because
the update trigger might decide not to update after all, and therefore
FOUND
Tom Lane schrieb:
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes:
I have defined an BEFORE UPDATE trigger. The trigger catch every update,
change some columns of the new row, make an insert of the new row and
returns null to abort the update.
Why in the world would you do that? Just return t
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes:
> I have defined an BEFORE UPDATE trigger. The trigger catch every update,
> change some columns of the new row, make an insert of the new row and
> returns null to abort the update.
Why in the world would you do that? Just return the modified row
Hey Dmitriy,
thanks for your reply.
I think, its would be better to use rule on update instead of the trigger
in such case as you.
I've played the whole weekend with the rule-system, but it didn't work
for my case. I have a dynamic trigger, which takes cares about revision
of rows for every
Hello,
i have a non-trival problem and i do not believe that it is solvable.
I have defined an BEFORE UPDATE trigger. The trigger catch every update,
change some columns of the new row, make an insert of the new row and
returns null to abort the update.
All fine till here :)
Now the problem:
Jasen Betts schrieb:
On 2010-05-11, Torsten Zühlsdorff wrote:
Hello,
i have a problem with a trigger written in pl/pgsql.
It looks like this:
CREATE OR REPLACE FUNCTION versionize()
RETURNS TRIGGER
AS $$
BEGIN
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not
On 2010-05-11, Torsten Zühlsdorff wrote:
> Hello,
>
> i have a problem with a trigger written in pl/pgsql.
>
> It looks like this:
>
> CREATE OR REPLACE FUNCTION versionize()
> RETURNS TRIGGER
> AS $$
> BEGIN
>
>NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
>
>/* not w
On 05/11/10 18:26, Torsten Zühlsdorff wrote:
Tom Lane schrieb:
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes:
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not working line, just a stub:
EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW;
*/
RETU
Torsten,
Usually, the “insert ... (select ...)” has the select portion enclosed in
parenthesis. Don't know if solution is that simple but did not see it in your
examples. It may be worth a try.
Stuart
- Original message -
> Hello,
>
> i have a problem with a trigger written in pl/pgs
Hello,
i have a problem with a trigger written in pl/pgsql.
It looks like this:
CREATE OR REPLACE FUNCTION versionize()
RETURNS TRIGGER
AS $$
BEGIN
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not working line, just a stub:
EXECUTE 'INSERT INTO ' || TG_TABLE_NAM
Tom Lane schrieb:
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes:
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not working line, just a stub:
EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW;
*/
RETURN NULL;
This seems like the
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes:
>NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
>/* not working line, just a stub:
>EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW;
>*/
>RETURN NULL;
This seems like the hard way. Why do
Hello,
i have a problem with a trigger written in pl/pgsql.
It looks like this:
CREATE OR REPLACE FUNCTION versionize()
RETURNS TRIGGER
AS $$
BEGIN
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not working line, just a stub:
EXECUTE 'INSERT INTO ' || TG_TABLE_NAM
Hello,
i have a problem with a trigger written in pl/pgsql.
It looks like this:
CREATE OR REPLACE FUNCTION versionize()
RETURNS TRIGGER
AS $$
BEGIN
NEW.revision := addContentRevision (OLD.content_id, OLD.revision);
/* not working line, just a stub:
EXECUTE 'INSERT INTO ' || TG_TABLE_NAM
On Mon, Mar 1, 2010 at 9:10 PM, Ray Madigan wrote:
>
> What I want to do is when I do a SELECT on the Catalog and deliver the
> result to the user, I want to check to see if the FooKey is in the users
> ToDo table and set the value of a column isToDo to true or false depending
> on if the FooKey e
@postgresql.org] On Behalf Of Ray Madigan
Sent: Monday, March 01, 2010 7:11 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Trigger on select :-(
What I want is to have a trigger on select, but since I have searched
the archives I know that is not possible. I also read that view rules
is the tech
What I want is to have a trigger on select, but since I have searched the
archives I know that is not possible. I also read that view rules is the
technology is whats available. Having never used views before I can't seem
to get my mind to figure out what I need to do to solve my problem.
I have
Sridhar Reddy Ratna wrote:
>
> cmd := 'INSERT INTO ' || dateTable ||
> EXECUTE cmd;
> RETURN NEW;
> If I changed the RETURN NEW to RETURN NULL its inserting only one row.
Yes. RETURN NEW allows the insert to procede normally so you end up with
the two rows.
> But to work wi
Sridhar ratna
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of Richard Huxton
Sent: Wednesday, September 09, 2009 3:35 PM
To: Sridhar Reddy Ratna
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] trigger failed to
Sridhar Reddy Ratna wrote:
>
> dateTable := coll_fp_subdtls_01;
>
> ELSE
>
> dateTable := coll_fp_subdtls_02;
> ERROR: column "coll_fp_subdtls_01" does not exist
>
> ERROR: column "coll_fp_subdtls_01" does not exist
I think you mi
Hi all,
I have created a table and partitions as below.
CREATE TABLE coll_fp_submission_details
(
rrid numeric NOT NULL,
sid numeric NOT NULL,
pfid numeric NOT NULL,
"timestamp" date NOT NULL,
schema_version numeric NOT NULL,
details character varying NOT NULL,
app_
Hi,
If I try this to run in a trigger function
'perform dblink_connect('myconnect','dbname=postgres password=uzleuven');
perform dblink_exec('myconnect', 'insert into test (uid) values (' ||
quote_literal(NEW.pat_id) || ')');
return new;
perform dblink_disconnect('myconnect');'
I get the mess
Sigrid Thijs writes:
> I've bumped into a problem with a trigger before delete that I do not
> immediately understand. I have made a simple example that also illustrates
> the issue, but in reality the database structure is more complex.
The reason it doesn't work is that the delete from member c
Hello,
I've bumped into a problem with a trigger before delete that I do not
immediately understand. I have made a simple example that also illustrates
the issue, but in reality the database structure is more complex.
Here's the database scheme:
create table club (
club_id serial n
I would develop like this (No so many changes, it is basically a small
trigger)
create or replace function compound_rows_range_check() returns trigger as
$body$
DECLARE
BAYNO int4;
BEGIN
-- First Verification = if changing compound or row fail
IF (old.co_id <> new.co_id or
old.cr_id <>
I have managed to develop one solution using functions and triggers. Has
anyone got a better solution?
Gary
create unique index "compound_bays_unique_index" on compound_bays using btree
(co_id,cr_id,cb_id);
create or replace function compound_rows_range_check() returns trigger as
$proc$
DECLA
With some version (but I don't remember which) I had the same problem.
I solved it by assigning TG_ARGV[0] to a variable and use the variable in the
RAISE NOTICE.
>>> Tom Lane <[EMAIL PROTECTED]> 2008-10-09 19:22 >>>
"Marcin Krawczyk" <[EMAIL PROTECTED]> writes:
> And here's what RAISE NOTICE lo
"Marcin Krawczyk" <[EMAIL PROTECTED]> writes:
> And here's what RAISE NOTICE looks like : NOTICE: TG_ARGV = ,
> TG_NARGS = 0, par =
> What's wrong with it ?? I'm running 8.1.4
Works for me:
regression=# insert into test_table values(1);
INSERT 0 1
regression=# update test_table set f1 = 2;
NOTI
Hi guys. I'm trying to pass a parameter to trigger procedure but it's not
working and I have no idea why since it looks pretty ok. Here's what I do :
CREATE OR REPLACE FUNCTION test_proc()
RETURNS "trigger" AS
$BODY$
DECLARE
chk boolean;
parinteger := TG_ARGV[0];
BEGIN
RAISE NOTICE 'TG_
On Wed, Sep 17, 2008 at 5:45 PM, hubert depesz lubaczewski
<[EMAIL PROTECTED]> wrote:
> On Wed, Sep 17, 2008 at 05:08:39PM +0200, Raphael Bauduin wrote:
>> Would you have a little example on how you would do it?
>
> show us what you have done - it will be easier to find/fix/explain than
> to write
HI,
On Sat, Aug 11, 2007 at 9:07 PM, hubert depesz lubaczewski
<[EMAIL PROTECTED]> wrote:
> On Sat, Aug 11, 2007 at 02:45:09AM -0500, Javier Fonseca V. wrote:
>> I think that it's working alright except for the next line:
>
> doing this in plpgsql is very complicated (or even impossible assuming
>
On 11/01/2008, Simon Riggs <[EMAIL PROTECTED]> wrote:
>
> On Fri, 2008-01-11 at 08:24 +, Richard Huxton wrote:
>
> > I've always considered TRUNCATE to be DDL rather than DML. I mentally
> > group it with DROP TABLE rather than DELETE>
>
> DDL/DML probably isn't the right split, since its then
Added to TODO:
> * Add ability to trigger on TRUNCATE
>
> http://archives.postgresql.org/pgsql-sql/2008-01/msg00050.php
---
Simon Riggs wrote:
> On Fri, 2008-01-11 at 08:24 +, Richard Huxton wrote:
>
> > I've always
On Fri, 2008-01-11 at 08:24 +, Richard Huxton wrote:
> I've always considered TRUNCATE to be DDL rather than DML. I mentally
> group it with DROP TABLE rather than DELETE>
DDL/DML probably isn't the right split, since its then arguable as to
which group of commands it belongs in.
I see we
On Jan 11, 2008, at 2:24 AM, Richard Huxton wrote:
Tom Lane wrote:
Alvaro Herrera <[EMAIL PROTECTED]> writes:
My thinking is that a TRUNCATE trigger is a per-statement trigger
which
doesn't have access to the set of deleted rows (Replicator uses
it that
way -- we replicate the truncate act
Tom Lane wrote:
Alvaro Herrera <[EMAIL PROTECTED]> writes:
My thinking is that a TRUNCATE trigger is a per-statement trigger which
doesn't have access to the set of deleted rows (Replicator uses it that
way -- we replicate the truncate action, and replay it on the replica).
In that way it would
[EMAIL PROTECTED] (Tom Lane) writes:
> Alvaro Herrera <[EMAIL PROTECTED]> writes:
>> Gerardo Herzig escribió:
>>> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level
>>> thing than i think.
>
>> TRUNCATE currently does not fire triggers, but that doesn't mean it's
>> impossible
Alvaro Herrera wrote:
> My thinking is that a TRUNCATE trigger is a per-statement trigger which
> doesn't have access to the set of deleted rows.
> In that way it would be different from a per-statement trigger for
> DELETE.
Completely agree.
A truncate trigger should run a different function
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> My thinking is that a TRUNCATE trigger is a per-statement trigger which
> doesn't have access to the set of deleted rows (Replicator uses it that
> way -- we replicate the truncate action, and replay it on the replica).
> In that way it would be differen
Tom Lane wrote:
Alvaro Herrera <[EMAIL PROTECTED]> writes:
Gerardo Herzig escribió:
Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level
thing than i think.
TRUNCATE currently does not fire triggers, but that doesn't mean it's
impossible to do it. I thin
Tom Lane escribió:
> Alvaro Herrera <[EMAIL PROTECTED]> writes:
> > Gerardo Herzig escribi�:
> >> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level
> >> thing than i think.
>
> > TRUNCATE currently does not fire triggers, but that doesn't mean it's
> > impossible to do it. I
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> Gerardo Herzig escribió:
>> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level
>> thing than i think.
> TRUNCATE currently does not fire triggers, but that doesn't mean it's
> impossible to do it. I think it would be fairly easy to
Gerardo Herzig escribió:
> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level
> thing than i think.
TRUNCATE currently does not fire triggers, but that doesn't mean it's
impossible to do it. I think it would be fairly easy to add support
for that.
Currently, Mammoth Replica
Pavel Stehule wrote:
On 08/01/2008, Chris Browne <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] (Gerardo Herzig) writes:
Hi all. Acording to the docs, TRUNCATE will not fire a DELETE trigger
on the table being truncated.
There is a way to capture a TRUNCATE in any way?
I think th
Hello
theoretically you can have trigger on any statement, but I am not sure
about conformance with std. But, you can wrap TRUNCATE statement into
some procedure, and then call this procedure with some other actions.
Regards
Pavel Stehule
On 08/01/2008, Chris Browne <[EMAIL PROTECTED]> wrote:
>
[EMAIL PROTECTED] (Gerardo Herzig) writes:
> Hi all. Acording to the docs, TRUNCATE will not fire a DELETE trigger
> on the table being truncated.
> There is a way to capture a TRUNCATE in any way?
I think there's some sort of "to do" on that...
It ought to be not *too* difficult (I imagine!) to
Hi all. Acording to the docs, TRUNCATE will not fire a DELETE trigger on
the table being truncated.
There is a way to capture a TRUNCATE in any way?
Thanks!
Gerardo
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
Ouch, that hurts! It suddenly dawns on me . . . Big difference on table
that you specify and table where it
actually takes effect. Confusing at first. Thanks a million, Tom.
"Rolf A. de By" <[EMAIL PROTECTED]> writes:
Yes, this is an inheritance set-up. But actually no: I am executing al
"Rolf A. de By" <[EMAIL PROTECTED]> writes:
> Yes, this is an inheritance set-up. But actually no: I am executing all
> my data changes against the parent table, and want the trigger on that
> parent table to fire for an insert on the parent table as it does. But
> I also want the trigger to f
Thanks Tom,
Yes, this is an inheritance set-up. But actually no: I am executing all
my data changes against the parent table, and want the trigger on that
parent table to fire for an insert on the parent table as it does. But
I also want the trigger to fire when an update on the parent table
"Rolf A. de By" <[EMAIL PROTECTED]> writes:
> Thanks for that. There is some misunderstanding here. For this example,
> I had taken the sting out of my trigger function and turned it into a
> much more concise no-op, with warnings. The actual code of my original
> trigger function is irrelevan
Erik,
Thanks for that. There is some misunderstanding here. For this example,
I had taken the sting out of my trigger function and turned it into a
much more concise no-op, with warnings. The actual code of my original
trigger function is irrelevant. The no-op trigger function displays the
On Dec 12, 2007, at 3:38 PM, Rolf A. de By wrote:
Greetings list,
Running pg 8.2.3. on a windows machine, I have become blind in a
trigger definition puzzle, so hope that somebody may help me
understand where I goof.
I have a base table i_s that has three tables that inherit from it,
Greetings list,
Running pg 8.2.3. on a windows machine, I have become blind in a
trigger definition puzzle, so hope that somebody may help me understand
where I goof.
I have a base table i_s that has three tables that inherit from it, one
of them being i_s_nowhere. The base table should be
chester c young wrote:
> how are you preventing recursion?
>
>
That could be the problem, suggestions?
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
I want to write a trigger that updates a different row on the same
table. It's pretty basic: before the any row in his table updated I
want to set a only row that has the value true to false. I keep getting
this error:
SQL statement "update theirry.articles set master_featured = false where
mast
On Sat, Aug 11, 2007 at 02:45:09AM -0500, Javier Fonseca V. wrote:
> I think that it's working alright except for the next line:
doing this in plpgsql is very complicated (or even impossible assuming
that any table can have the same trigger). i would rather suggest using
pl/perl - writing somethin
Yes Tom, you're right, but the real problem is that I need to use an EXECUTE
statement because my table name is dynamic. In your example, you used logt
as a static table name, and that doesn't need an EXECUTE statement.
So I think that I'll have to rewrite a Trigger Procedure for each table and
t
2007/8/11, Tom Lane <[EMAIL PROTECTED]>:
> "Pavel Stehule" <[EMAIL PROTECTED]> writes:
> > NEW is only plpgsql variable. It isn't visible on SQL level.
>
> Correct, but:
>
> > You cannot use new.*, you can:
> > execute 'INSERT ...' || 'VALUES(' || new.a || ',' || new.b
>
> You're both overthin
"Pavel Stehule" <[EMAIL PROTECTED]> writes:
> NEW is only plpgsql variable. It isn't visible on SQL level.
Correct, but:
> You cannot use new.*, you can:
> execute 'INSERT ...' || 'VALUES(' || new.a || ',' || new.b
You're both overthinking the problem. In recent releases (at least
since 8.
NEW is only plpgsql variable. It isn't visible on SQL level. You
cannot use new.*, you can:
execute 'INSERT ...' || 'VALUES(' || new.a || ',' || new.b
regards
Pavel
2007/8/11, Javier Fonseca V. <[EMAIL PROTECTED]>:
>
>
> Hello.
>
> I'm doing a Trigger Procedure in pl/pgSQL. It makes some k
Hello.
I'm doing a Trigger Procedure in pl/pgSQL. It makes some kind of auditing.
I think that it's working alright except for the next line:
EXECUTE 'INSERT INTO ' || quote_ident(somedynamictablename) || ' SELECT
new.*';
PostgreSQL keeps telling me: "ERROR: NEW used in query that is not in a
> > does the post trigger on A wait until post trigger on B is
> executed? -> > this seems intuitive to me.
>
> How can it wait until the trigger on B is executed if the trigger on
> B doesn't
> actually get triggered until someone updates B and it's the trigger
> on A
> doing the update?
trigge
"chester c young" <[EMAIL PROTECTED]> writes:
> tables A and B: a post row trigger on A cause updates on B which has
> its own post row trigger.
>
> does the post trigger on A wait until post trigger on B is executed? -
> this seems intuitive to me.
How can it wait until the trigger on B is execu
tables A and B: a post row trigger on A cause updates on B which has
its own post row trigger.
does the post trigger on A wait until post trigger on B is executed? -
this seems intuitive to me.
does the post trigger on B wait until the trigger on A has completed?
or is post trigger A launched as
On 8/31/06, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote:
Bono,I must check each insert on my Points(each shop generate a new line on Points table).When I insert the record on points I must see the field Value(on points table already) and update the Client.Points
field based in some
On 8/30/06, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote:
Hi list,I have a table like this:Points-Idoperationvalueand another two tables like thisClient Rule
-
On 8/28/06, Henry Ortega <[EMAIL PROTECTED]> wrote:
Here's what I am doing:I have this table:employee payrate effective tstamp end_date (to be updated by trigger)jdoe 1000 04-01-2006 2006-03-10 13:39:
07.614945jdoe
Hi list,I have a table like this:Points-Idoperationvalueand another two tables like thisClient Rule
---id idname
On Mon, Aug 28, 2006 at 11:53:36AM -0400, Henry Ortega wrote:
> CREATE FUNCTION updated_end_date() RETURNS trigger AS '
> BEGIN
>update table set end_date=(select effective-1 from table t2 where
> t2.employee=table.employee and t2.effective>table.effective order by
> t2.effective limit 1);
>
Here's what I am doing:I have this table:employee payrate effective tstamp end_date (to be updated by trigger)jdoe 1000 04-01-2006 2006-03-10 13:39:
07.614945jdoe 1500 04-01-2006 2006-03-12 15:
On Mon, Aug 28, 2006 at 10:02:32AM -0400, Henry Ortega wrote:
> I have a On Insert Trigger that updates one of the columns in that same
> table.
>
> Is there a way for the trigger to run only for the newly inserted records?
> Instead of all records in the database?
Row-level INSERT and UPDATE trig
I have a On Insert Trigger that updates one of the columns in that same table.Is there a way for the trigger to run only for the newly inserted records? Instead of all records in the database?E.g.:ID Start_Date End_Date
001 08-01-2006 002 08-02-2006On Insert/Update, Update End_Date=
On Fri, Aug 18, 2006 at 07:17:27PM +0200, Jacobo Garca wrote:
> I'm running a simple query inside a function that is associated with a
> trigger:
>
>SELECT tipo INTO tipocuenta FROM producto WHERE codigo_cuenta=
> NEW.codigo_destino;
>
> I am getting this error when running the code on pgadmi
Hello.I'm running a simple query inside a function that is associated with a trigger: SELECT tipo INTO tipocuenta FROM producto WHERE codigo_cuenta=NEW.codigo_destino
;I am getting this error when running the code on pgadmin IIIERROR: NEW used in query that is not in a rule
QUERY: SELECT tipo
On 7/13/06, Adrian Klaver <[EMAIL PROTECTED]> wrote:
For plpgsql use TG_OP. See link below.http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.htmlOn Thursday 13 July 2006 03:50 pm, Daniel Caune wrote:
> Hi, I've created a trigger BEFORE INSERT OR UPDATE on a table and, indeed,> when
For plpgsql use TG_OP. See link below.
http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html
On Thursday 13 July 2006 03:50 pm, Daniel Caune wrote:
> Hi,
>
>
>
> I've created a trigger BEFORE INSERT OR UPDATE on a table and, indeed,
> when the trigger is raised before insertion the re
Hi,
I’ve created a trigger BEFORE INSERT OR UPDATE on
a table and, indeed, when the trigger is raised before insertion the record “old”
is not assigned. Is there a way to distinguish in the trigger procedure from
an insert statement to an update statement?
Regards,
--
Danie
On Wed, 12 Apr 2006, George Young wrote:
> [PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1]
>
> I'm starting to use lots of foreign key constraints to keep my
> data clean. In one case, however, I need to allow null values
> for the key. E.g.:
>
> create table opset_steps
George Young wrote:
> Since foreign keys per se can't do this, I presume the way
> is to use triggers, though I have not used triggers before.
Says who? Just don't specify NOT NULL on the referencing column.
--
Alvaro Herrerahttp://www.CommandPrompt.com/
The Pos
[PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1]
I'm starting to use lots of foreign key constraints to keep my
data clean. In one case, however, I need to allow null values
for the key. E.g.:
create table opset_steps(opset text, step text, step_num int);
create table st
Stephen,
You don't need to use a seperate batch to clean up the table. As
Stephan pointed out, you can call nextval after you determine that the
new row isn't a duplicate.
In case you misunderstood what Stephan had suggested let me try to
explain what is happening.
When PostgreSQL receives an IN
Hi, Stephen,
Foster, Stephen wrote:
> That's what I thought was going to be the answer. I was just hoping I
> was making a mistake somehow. It's no big deal but I like things
> organized and hate giant holes.
>
> Ok, one more thing for one of the batch jobs. No problem I have a
> cleanup routi
Lee Foster/
-Original Message-
From: Stephan Szabo [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 12, 2006 5:11 PM
To: Foster, Stephen
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Trigger/Sequence headache
On Sun, 12 Feb 2006, Foster, Stephen wrote:
> This is going to be one of those stupi
On Sun, 12 Feb 2006, Foster, Stephen wrote:
> This is going to be one of those stupid problems of mine. I have an
> insert trigger setup to verify that duplicate or repeating information
> isn't storage in the table. If trigger function finds the information
> as a duplicate it returns a NULL a
This is going to be one of those stupid problems of
mine. I have an insert trigger
setup to verify that duplicate or repeating information isn’t storage in
the table. If trigger function finds
the information as a duplicate it returns a NULL and the information isn’t
added; that works. T
I do not know of a way to make your trigger run less often, but you could only
have it do the insert if something changes. This is what we do:
CREATE or replace FUNCTION UPDATE_SERVER_HST() RETURNS TRIGGER AS '
begin
if (OLD.ADD_DATE is distinct from NEW.ADD_DATE
or OLD.HOSTNAME
Hi,
I've the following problem and I don't know how to solve it: There is a
table with about 10-12 fields, a couple of those fields are updated very
often (about 30 times / minute or even more). This is my table (more or
less):
crete table monitor(
time Timestamp,
time2 timestamp,
.
Josep Sanmartí wrote:
Hi,
readding around I just found this:
The CREATE TRIGGER statement in PostgreSQL implements a subset of the
SQL99 standard. (There are no provisions for triggers in SQL92.) The
following functionality IS MISSING:
* SQL99 allows triggers to fire on updates to specific col
Hi,
readding around I just found this:
The CREATE TRIGGER statement in PostgreSQL implements a subset of the
SQL99 standard. (There are no provisions for triggers in SQL92.) The
following functionality IS MISSING:
* SQL99 allows triggers to fire on updates to specific columns (e.g.,
AFTER UPDA
Hi,
My trigger's running on a table that works perfectly. This trigger calls
a function that inserts or modifies a row of a different table. My
problem is that I need to optimize this trigger, and the only way that
I've found is to fire the trigger when certain table fields are
modified. I
Hello,
I created a table with a OID Column to carry the identifier for a Large
Object.
Now i want to run a trigger is the data of the large object has changed. To do
this I created an ON UPDATE-trigger on the table, but the trigger does get
fired if i only change the data of the large object (
Hi Peter,
On Sun, 2005-11-20 at 12:08 +0100, Peter Eisentraut wrote:
> Joost Kraaijeveld wrote:
> > 1. Does an insert, update or delete statement return before or after
> > an "After" trigger (is such a trigger or rule synchronous or
> > a-synchronous?
>
> Synchronous
>
> > 2. Is there a concept
Joost Kraaijeveld wrote:
> 1. Does an insert, update or delete statement return before or after
> an "After" trigger (is such a trigger or rule synchronous or
> a-synchronous?
Synchronous
> 2. Is there a concept of a rule or trigger that fails?
> If so, if a trigger or rule fails, does the inser
1 - 100 of 243 matches
Mail list logo