[GENERAL] Triggers not being fired with pglogical

2016-05-31 Thread Jaime Rivera
Hi, I have a basic replica with pglogical 1.1 and postgres 9.5 on both servers publisher and subscriber. I have triggers on publisher and subscriber tables, but the trigger on subscriber table is not being fired. Is it possible to fire the trigger with pglogical replication? Thanks in advance

Re: [GENERAL] Triggers on foreign Postgres 9.3 tables in Postgres 9.4

2015-02-27 Thread MattF
Thank you Michael! I will let the admin know then! -- View this message in context: http://postgresql.nabble.com/Triggers-on-foreign-Postgres-9-3-tables-in-Postgres-9-4-tp5839559p5839749.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general

Re: [GENERAL] Triggers and scalability in high transaction tables.

2015-02-26 Thread Tim Uckun
I just want to make sure I understood correctly. All the triggers are firing in a single thread assigned to the connection and will be run serially no matter how many tables are firing triggers. If this is correct then yes I guess I have to create a queue of some sort and process them via an

[GENERAL] Triggers on foreign Postgres 9.3 tables in Postgres 9.4

2015-02-26 Thread MattF
My company has a data warehouse, currently running on Postgres 9.3, as well as the production servers also running on Postgres 9.3. We have connections to foreign tables from the warehouse, however I've noticed that implementing triggers on foreign tables is not supported in Postgres 9.3, and is a

Re: [GENERAL] Triggers Operations

2015-02-26 Thread Adrian Klaver
On 02/25/2015 06:14 PM, Emanuel Araújo wrote: Hi, I have an application that replicates data from an Oracle database for postgresql. The flow goes as follows: oracle.table1 - AppSincronizador - postgresql.table1 - Trigger (upd, ins, del) - postgresql.table2 I'm having situations where the

[GENERAL] Triggers and scalability in high transaction tables.

2015-02-26 Thread Tim Uckun
I want to write a trigger which runs semi-complicated code after each insert. I have done some reading and from what I can gather this could cause problems because after insert triggers don't spill to the disk and can cause queue problems. Many people suggest LISTEN NOTIFY but that's not going

Re: [GENERAL] Triggers and scalability in high transaction tables.

2015-02-26 Thread Merlin Moncure
On Thu, Feb 26, 2015 at 3:54 PM, Tim Uckun timuc...@gmail.com wrote: I want to write a trigger which runs semi-complicated code after each insert. I have done some reading and from what I can gather this could cause problems because after insert triggers don't spill to the disk and can cause

Re: [GENERAL] Triggers and scalability in high transaction tables.

2015-02-26 Thread Jerry Sievers
Tim Uckun timuc...@gmail.com writes: I want to write a trigger which runs semi-complicated code after each insert.  I have done some reading and from what I can gather this could cause problems because after insert triggers don't spill to the disk and can cause queue problems.   Many

Re: [GENERAL] Triggers and scalability in high transaction tables.

2015-02-26 Thread John R Pierce
On 2/26/2015 2:03 PM, Merlin Moncure wrote: I would strongly advise you not to put complex processing in triggers if at all possible. Instead have the insert operation write a record into another table which forms a queue of work to do. That queue can then be walked by another process which

Re: [GENERAL] Triggers on foreign Postgres 9.3 tables in Postgres 9.4

2015-02-26 Thread Michael Paquier
On Fri, Feb 27, 2015 at 2:13 AM, MattF mfraz...@spacetimestudios.com wrote: I've talked to the admin here and he said that upgrading to Postgres 9.4 is possible, however the only risk is for us on the warehouse side is that it is entirely possible that while the warehouse servers will be

[GENERAL] Triggers Operations

2015-02-25 Thread Emanuel Araújo
Hi, I have an application that replicates data from an Oracle database for postgresql. The flow goes as follows: oracle.table1 - AppSincronizador - postgresql.table1 - Trigger (upd, ins, del) - postgresql.table2 I'm having situations where the data volume is large that the changes that should

[GENERAL] Triggers

2013-07-05 Thread itishree sukla
Hello Every one, Is Postgresql providing triggers on DB level, schema level ( in same DB)? Regards, Itishree

Re: [GENERAL] Triggers

2013-07-05 Thread Jov
the later ,in same db jov 在 2013-7-5 下午4:32,itishree sukla itishree.su...@gmail.com写道: Hello Every one, Is Postgresql providing triggers on DB level, schema level ( in same DB)? Regards, Itishree

Re: [GENERAL] Triggers

2013-07-05 Thread itishree sukla
I didn't get you, you mean trigger is possible on schema level? if yes can you give example. Thank you On Fri, Jul 5, 2013 at 3:56 PM, Jov zhao6...@gmail.com wrote: the later ,in same db jov 在 2013-7-5 下午4:32,itishree sukla itishree.su...@gmail.com写道: Hello Every one, Is Postgresql

Re: [GENERAL] Triggers

2013-07-05 Thread Thomas Kellerer
itishree sukla, 05.07.2013 10:29: Hello Every one, Is Postgresql providing triggers on DB level, schema level ( in same DB)? You are probably referring to DDL triggers and similar things (a trigger when a table is created or dropped, a user logs in and so on). The answer is no as far as I

Re: [GENERAL] Triggers

2013-07-05 Thread Thomas Kellerer
Thomas Kellerer, 05.07.2013 13:46: Postgres 9.3 will add event triggers, but they can only be written in SQL That should have been: only C and procedural languages like PL/pgSQL -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

[GENERAL] Triggers NOT running as table owner

2013-06-27 Thread Sandro Santilli
According to release notes of 8.3.18 (yeah, old docs) a trigger runs with the the table owner permission. This is the only document I found about this matter: http://www.postgresql.org/docs/8.3/static/release-8-3-18.html Require execute permission on the trigger function for CREATE TRIGGER

Re: [GENERAL] Triggers NOT running as table owner

2013-06-27 Thread Sergey Konoplev
On Thu, Jun 27, 2013 at 4:58 AM, Sandro Santilli s...@keybit.net wrote: According to release notes of 8.3.18 (yeah, old docs) a trigger runs with the the table owner permission. This is the only document I found about this matter: http://www.postgresql.org/docs/8.3/static/release-8-3-18.html

[GENERAL] Triggers on Foreign Tables

2013-04-04 Thread Robert Lefkowitz
Not sure if this is a feature request or a bug report. I'm trying to use Foreign Tables for a variety of things and it is useful to have a foreign table which appears to be read/write. Having set one up, I can select data from it. However, I can't insert, update or delete. No worries,

Re: [GENERAL] Triggers on Foreign Tables

2013-04-04 Thread Adrian Klaver
On 04/04/2013 04:28 PM, Robert Lefkowitz wrote: Not sure if this is a feature request or a bug report. I'm trying to use Foreign Tables for a variety of things and it is useful to have a foreign table which appears to be read/write. Having set one up, I can select data from it. However, I

[GENERAL] Triggers operations and log_statement = all not working?

2013-01-16 Thread Edson Richter
Hi! I'm debugging few triggers I wrote these days, and I can't see the triggers statements being logged. Probably I'm doing something wrong. I just enabled log_statement = 'all' In postgresql.conf, but I can see all statements issued by my application, but the statements in trigger don't

Re: [GENERAL] Triggers operations and log_statement = all not working?

2013-01-16 Thread Edson Richter
Em 16/01/2013 13:56, Edson Richter escreveu: Hi! I'm debugging few triggers I wrote these days, and I can't see the triggers statements being logged. Probably I'm doing something wrong. I just enabled log_statement = 'all' In postgresql.conf, but I can see all statements issued by my

Re: [GENERAL] triggers and FK cascades

2011-03-19 Thread Vincent Veyron
Le vendredi 18 mars 2011 à 08:20 +, Grzegorz Jaśkiewicz a écrit : There's a generic trigger that sends a signal to a process whenever changes are made (via listen/notify mechanism), but when FK cascade fires it will cause a mass amount of notifies to be send out and I want to avoid it.

Re: [GENERAL] triggers and FK cascades

2011-03-18 Thread Grzegorz Jaśkiewicz
- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Grzegorz Jaskiewicz Sent: Thursday, March 17, 2011 6:41 PM To: pgsql-general@postgresql.org Subject: [GENERAL] triggers and FK cascades Considering the following example. Tables A and B

[GENERAL] triggers and FK cascades

2011-03-17 Thread Grzegorz Jaśkiewicz
Considering the following example. Tables A and B. Table A contains some data. Table B reefers to table A using FK with 'on delete cascade'. Table B has a trigger on it, after delete per row Now, is there any way I can tell in the trigger on table B that it has been called from a direct delete on

Re: [GENERAL] triggers and FK cascades

2011-03-17 Thread David Johnston
J. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Grzegorz Jaskiewicz Sent: Thursday, March 17, 2011 6:41 PM To: pgsql-general@postgresql.org Subject: [GENERAL] triggers and FK cascades Considering the following

[GENERAL] Triggers and locking

2010-09-21 Thread William Temperley
Dear all, I have a single source table that is referenced by six specialization tables, which include: journal_article report 4 more There is a citation column in the source, which is what will be displayed to users. This is generated by a trigger function on each specialization table that

Re: [GENERAL] Triggers and locking

2010-09-21 Thread Alban Hertroys
On 21 Sep 2010, at 16:13, William Temperley wrote: Dear all, I have a single source table that is referenced by six specialization tables, which include: journal_article report 4 more e.g.: update source set citation = get_report_citation( (select source from source where id

Re: [GENERAL] Triggers and locking

2010-09-21 Thread William Temperley
On 21 September 2010 18:39, Alban Hertroys dal...@solfertje.student.utwente.nl wrote: On 21 Sep 2010, at 16:13, William Temperley wrote: Dear all, I have a single source table that is referenced by six specialization tables, which include: journal_article report 4 more e.g.:

Re: [GENERAL] Triggers made with plpythonu performance issue

2009-12-19 Thread Adrian Klaver
On Friday 18 December 2009 11:00:33 am sabrina miller wrote: Hi everybody, My requirements was: + Made a table charge to be partitioned by carrier and month + summarize by charges + summarize by users, + each summarization must be by month and several others columns. Doesn't sound

[GENERAL] Triggers made with plpythonu performance issue

2009-12-18 Thread sabrina miller
Hi everybody, My requirements was: + Made a table charge to be partitioned by carrier and month + summarize by charges + summarize by users, + each summarization must be by month and several others columns. Here is the database CREATE TABLE charges.charge ( id serial NOT NULL,

[GENERAL] Triggers and SQL

2009-10-05 Thread Yadisnel Galvez Velazquez
How I cant optain de SQL (if is posible) of any STATEMENT in an AFTER Trigger Function in C? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] triggers and execute...

2009-05-01 Thread Scott Marlowe
On Tue, Apr 28, 2009 at 10:46 PM, David Fetter da...@fetter.org wrote: On Tue, Apr 28, 2009 at 08:20:34PM -0600, Scott Marlowe wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com

Re: [GENERAL] triggers and execute...

2009-05-01 Thread Alban Hertroys
On Apr 29, 2009, at 4:20 AM, Scott Marlowe wrote: Oh man, it just gets worse. I really need a simple elegant solution here, because if I try to build the query by hand null inputs make life a nightmare. I had built something like this: q = 'insert into '||schem||'.page_access_'||part||'

Fwd: [GENERAL] triggers and execute...

2009-05-01 Thread Dimitri Fontaine
Hi, it seems it didn't make it the first time. Début du message réexpédié : De : Dimitri Fontaine dfonta...@hi-media.com Date : 30 avril 2009 12:03:10 HAEC À : pgsql-general@postgresql.org Objet : Rép : [GENERAL] triggers and execute... On Monday 27 April 2009 22:32:22 Scott Marlowe wrote: OK

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Dimitri Fontaine
On Monday 27 April 2009 22:32:22 Scott Marlowe wrote: OK, I'm hitting a wall here. I've written this trigger for partitioning: create or replace function page_access_insert_trigger () returns trigger as $$ DECLARE part text; q text; BEGIN part =

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Scott Marlowe
On Tue, Apr 28, 2009 at 11:24 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Apr 28, 2009 at 10:46 PM, David Fetter da...@fetter.org wrote: On Tue, Apr 28, 2009 at 08:20:34PM -0600, Scott Marlowe wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com

Re: [GENERAL] triggers and execute...

2009-04-30 Thread David Fetter
On Tue, Apr 28, 2009 at 08:20:34PM -0600, Scott Marlowe wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Alvaro Herrera
Scott Marlowe escribió: Oh man, it just gets worse. I really need a simple elegant solution here, because if I try to build the query by hand null inputs make life a nightmare. I had built something like this: q = 'insert into '||schem||'.page_access_'||part||' values (

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Scott Marlowe
On Wed, Apr 29, 2009 at 4:23 AM, Alban Hertroys dal...@solfertje.student.utwente.nl wrote: On Apr 29, 2009, at 4:20 AM, Scott Marlowe wrote: Oh man, it just gets worse.  I really need a simple elegant solution here, because if I try to build the query by hand null inputs make life a

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Richard Broersma
I wonder if it would be easier to perodically replace the entire trigger function with one that inserts to the correct table using CRON+SED rather than dynamically building SQL. This might be a bad idea however. I'm just thinking outside the box. -- Regards, Richard Broersma Jr. Visit the

Re: [GENERAL] triggers and execute...

2009-04-29 Thread Jasen Betts
On 2009-04-29, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for

Re: [GENERAL] triggers and execute...

2009-04-29 Thread Erik Jones
On Apr 29, 2009, at 4:14 AM, Jasen Betts wrote: On 2009-04-29, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a

Re: [GENERAL] triggers and execute...

2009-04-28 Thread Sam Mason
On Mon, Apr 27, 2009 at 03:37:22PM -0600, Scott Marlowe wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma wrote: At this point I don't think that there is a way for this function to know the correct table type of new.* since page_access_... is still only a concatenated string.  There

Re: [GENERAL] triggers and execute...

2009-04-28 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for partitioning: create or replace function page_access_insert_trigger ()

[GENERAL] triggers and execute...

2009-04-27 Thread Scott Marlowe
OK, I'm hitting a wall here. I've written this trigger for partitioning: create or replace function page_access_insert_trigger () returns trigger as $$ DECLARE part text; q text; BEGIN part = to_char(new.timestamp,'MMDD'); q = 'insert into

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 2:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for partitioning: create or replace function page_access_insert_trigger () returns trigger as $$ DECLARE        part text;        q text; BEGIN        part

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Richard Broersma
On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for partitioning: create or replace function page_access_insert_trigger () returns trigger as $$ DECLARE        part text;        q text; BEGIN        part

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma richard.broer...@gmail.com wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe scott.marl...@gmail.com wrote: OK, I'm hitting a wall here.  I've written this trigger for partitioning: create or replace function page_access_insert_trigger ()

Re: [GENERAL] triggers

2009-04-17 Thread Yuriy Rusinov
Hello Gustavo ! Gente, buenos dias. Como consulto lo triggers desde psql? Unfortunately I don't know Spanish. As far as I understand your question was about triggers in postgresql. Trigger is the function calls automatically on operations insert-delete-update. -- Best regards, Sincerely

[GENERAL] triggers

2009-04-16 Thread Gustavo Rosso
Gente, buenos dias. Como consulto lo triggers desde psql? Gracias! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Triggers for a MPTT based table

2009-03-31 Thread Laurent Rahuel
Hi all, I wish to use a MPTT based table to store some hierachical datas. Here is my table definition: CREATE TABLE region ( id SERIAL NOT NULL, full_path VARCHAR(255) NOT NULL, lhs INTEGER NOT NULL, rhs INTEGER NOT NULL, level INTEGER NOT NULL,

Re: [GENERAL] triggers problems whit function

2008-10-23 Thread Guillaume Lelarge
Tom Lane a écrit : Guillaume Lelarge [EMAIL PROTECTED] writes: Fernando Moreno a écrit : A trigger function must have a specific structure, it takes no arguments It can take arguments. No, it can't. At least not in the declaration. Oops, you're right. Arguments shouldn't be declared,

Re: [GENERAL] triggers problems whit function

2008-10-23 Thread MOLINA BRAVO FELIPE DE JESUS
El mié, 22-10-2008 a las 15:01 -0500, Ma. Cristina Peña C. escribió: I want to use a function in to a trigger This is my CREATE FUNCTION subradio(integer) RETURNS integer AS 'select cast(count (claveubica) as integer ) from asradios where ubicacion =0;' LANGUAGE 'sql'; And

[GENERAL] triggers problems whit function

2008-10-22 Thread Ma . Cristina Peña C .
I want to use a function in to a trigger This is my CREATE FUNCTION subradio(integer) RETURNS integer AS 'select cast(count (claveubica) as integer ) from asradios where ubicacion =0;' LANGUAGE 'sql'; And my ttrigger is CREATE TRIGGER validaradios AFTER DELETE ON subestacion FOR EACH

Re: [GENERAL] triggers problems whit function

2008-10-22 Thread Fernando Moreno
2008/10/22 Ma. Cristina Peña C. [EMAIL PROTECTED] I want to use a function in to a trigger This is my CREATE FUNCTION subradio(integer) RETURNS integer AS 'select cast(count (claveubica) as integer ) from asradios where ubicacion =0;' LANGUAGE 'sql'; And my ttrigger is CREATE

Re: [GENERAL] triggers problems whit function

2008-10-22 Thread Guillaume Lelarge
Fernando Moreno a écrit : 2008/10/22 Ma. Cristina Peña C. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] I want to use a function in to a trigger This is my CREATE FUNCTION subradio(integer) RETURNS integer AS 'select cast(count (claveubica) as integer ) from asradios where

Re: [GENERAL] triggers problems whit function

2008-10-22 Thread Tom Lane
Guillaume Lelarge [EMAIL PROTECTED] writes: Fernando Moreno a écrit : A trigger function must have a specific structure, it takes no arguments It can take arguments. No, it can't. At least not in the declaration. regards, tom lane -- Sent via pgsql-general mailing

Re: [GENERAL] Triggers not working

2008-09-22 Thread Tom Lane
Dale Harris [EMAIL PROTECTED] writes: I'm running PostgreSQL 8.3.3 and I'm having trouble with triggers not always working. I have the following tables and functions as documented below. My problem is that if I perform an update on the Entity table and modify the Code field, why doesn't the

Re: [GENERAL] Triggers not working

2008-09-22 Thread Dale Harris
: [GENERAL] Triggers not working Dale Harris [EMAIL PROTECTED] writes: I'm running PostgreSQL 8.3.3 and I'm having trouble with triggers not always working. I have the following tables and functions as documented below. My problem is that if I perform an update on the Entity table and modify

Re: [GENERAL] Triggers not working

2008-09-22 Thread Tom Lane
Dale Harris [EMAIL PROTECTED] writes: The trigger trAccountUpdate got called, but why didn't the trigger trEntityUpdate get called? Triggers only apply to the exact table they're declared on, not to child tables. It does seem like there might be some use-case for applying a trigger to child

Re: [GENERAL] Triggers not working

2008-09-22 Thread Dale Harris
:[EMAIL PROTECTED] Sent: Tuesday, 23 September 2008 13:43 To: Dale Harris Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Triggers not working Dale Harris [EMAIL PROTECTED] writes: The trigger trAccountUpdate got called, but why didn't the trigger trEntityUpdate get called? Triggers

[GENERAL] Triggers not working

2008-09-21 Thread Dale Harris
Hi, I'm running PostgreSQL 8.3.3 and I'm having trouble with triggers not always working. I have the following tables and functions as documented below. My problem is that if I perform an update on the Entity table and modify the Code field, why doesn't the trigger for the Entity table

[GENERAL] Triggers et clefs primaires

2008-08-26 Thread Samuel ROZE
Bonjour, J'ai un trigger (AFTER FOR EACH ROW) sur une table qui à chaque fois qu'il y a un enregistrement sur cette même table, exécute une fonction pgplsql qui éxécute elle-même une fonction PL/sh qui exécute un script PHP. Dans ce script PHP, je créer 10 enregistrements dans une autre tables

Re: [GENERAL] Triggers et clefs primaires

2008-08-26 Thread Guillaume Lelarge
Samuel ROZE a écrit : [...] J'ai un trigger (AFTER FOR EACH ROW) sur une table qui à chaque fois qu'il y a un enregistrement sur cette même table, exécute une fonction pgplsql qui éxécute elle-même une fonction PL/sh qui exécute un script PHP. Dans ce script PHP, je créer 10

Re: [GENERAL] Triggers et clefs primaires

2008-08-26 Thread Samuel ROZE
Le mardi 26 août 2008 à 11:01 +0200, Guillaume Lelarge a écrit : Samuel ROZE a écrit : [...] J'ai un trigger (AFTER FOR EACH ROW) sur une table qui à chaque fois qu'il y a un enregistrement sur cette même table, exécute une fonction pgplsql qui éxécute elle-même une fonction PL/sh qui

Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-18 Thread Klint Gore
[see below] Kerri Reno wrote: Vance, I missed your earlier post, so I may be misunderstanding the situation, but I think you could do this more easily in plpython, because TD['new'] and TD['old'] are dictionaries, and you can traverse the dictionaries like this: for k, v in

Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-16 Thread Vance Maverick
15, 2008 8:06 PM To: Vance Maverick Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD? Vance Maverick wrote: I have a bunch of tables that are similar in some ways, and I'm about to put triggers on them. The triggers will all do

Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-16 Thread Vance Maverick
Thanks! Your solution clearly works, but it requires the shared function to enumerate all possible column names. In my real case, there are 8-10 distinct names, so that's a bit uglybut it works. Vance -Original Message- If you just need which table triggered the function then

Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-16 Thread Kerri Reno
Vance, I missed your earlier post, so I may be misunderstanding the situation, but I think you could do this more easily in plpython, because TD['new'] and TD['old'] are dictionaries, and you can traverse the dictionaries like this: for k, v in TD['new'].items(): if tblfld == k:

[GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-15 Thread Vance Maverick
I have a bunch of tables that are similar in some ways, and I'm about to put triggers on them. The triggers will all do essentially the same thing -- the only wrinkle is that the name of the column they operate on varies from table to table. I'd like to have just one trigger function, written

Re: [GENERAL] triggers: dynamic references to fields in NEW and OLD?

2008-05-15 Thread Klint Gore
Vance Maverick wrote: I have a bunch of tables that are similar in some ways, and I'm about to put triggers on them. The triggers will all do essentially the same thing -- the only wrinkle is that the name of the column they operate on varies from table to table. I'd like to have just one

[GENERAL] Triggers are disabled after restore

2008-03-26 Thread Andrus
I tried to restore database to 8.2.3 and 8.3 servers from pgAdmin After restore triggers do not fire. PgAdmin shows that trigger is attached to dok table: CREATE TRIGGER dok_btrig BEFORE INSERT ON firma1.dok FOR EACH ROW EXECUTE PROCEDURE firma1.dok_seq_trig(); select reltriggers from

[GENERAL] Triggers inheritance

2007-09-28 Thread Scott Ribe
Triggers have never been inherited, right? Not in any version? I'm pretty sure that's the case, but I'm debugging some old logging and just need to confirm it. -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ---(end of

Re: [GENERAL] Triggers inheritance

2007-09-28 Thread Tom Lane
Scott Ribe [EMAIL PROTECTED] writes: Triggers have never been inherited, right? Not in any version? AFAIR, no. If they had been I kinda doubt we would have removed it. regards, tom lane ---(end of broadcast)--- TIP 4:

Re: [GENERAL] Triggers: Detecting if a column value is explicitly set in an UPD ATE statement or not... (IS NULL not working?)

2007-08-04 Thread Decibel!
On Wed, Aug 01, 2007 at 09:30:25AM -0500, Weber, Geoffrey M. wrote: I want to set a BOOLEAN column value to FALSE by default for all INSERT and UPDATE statements performed against a particular table _UNLESS_ it's explicitly set to TRUE in the SQL statement. Here is the trigger I created: The

[GENERAL] Triggers: Detecting if a column value is explicitly set in an UPD ATE statement or not... (IS NULL not working?)

2007-08-01 Thread Weber, Geoffrey M.
I'm having a problem, and can't seem to find a good answer in the mailing list archives... sorry if I'm missing something obvious! Postgres version: 8.2.4 O/S: Solaris 10 I want to set a BOOLEAN column value to FALSE by default for all INSERT and UPDATE statements performed against a particular

[GENERAL] Triggers to allow user create table?

2007-05-27 Thread CAJ CAJ
Had a question on best approach with some security issues around on the fly table creation by a user. I want to users to create dynamic tables from the application. This means that the user logged in should have create table privileges at the database level. Assuming this is a security risk for

Re: [GENERAL] Triggers to allow user create table?

2007-05-27 Thread John DeSoi
See the SECURITY DEFINER option for CREATE FUNCTION. This way you don't have to give them create table privileges, but they can still create a table through your function. You'll need to use EXECUTE to create a table in pl/pgsql. On May 27, 2007, at 4:50 PM, CAJ CAJ wrote: Had a

Re: [GENERAL] Triggers inherited?

2007-02-23 Thread Marc Evans
Hi - I too have encountered this issue. The work around that I created was to have every table have a set of 3 cooresponding functions that know how to 1) create the table; 2) create triggers for the table; 3) create indexes for the table. By doing so, I then am able to use a lazy

Re: [GENERAL] Triggers inherited?

2007-02-23 Thread Bertram Scharpf
Hi, Am Freitag, 23. Feb 2007, 07:10:06 + schrieb Richard Huxton: Bertram Scharpf wrote: it is very inconvenient for me that triggers aren't inherited: Foreign keys too (which are a special type of trigger of course). Is this behaviour to be implemented at any point of time in the

[GENERAL] Triggers inherited?

2007-02-22 Thread Bertram Scharpf
Hi, it is very inconvenient for me that triggers aren't inherited: create table watch ( mod timestamp with time zone default '-infinity' not null ); create function update_mod() returns trigger ... create trigger update_mod before insert or update on watch for each row

Re: [GENERAL] Triggers inherited?

2007-02-22 Thread Richard Huxton
Bertram Scharpf wrote: Hi, it is very inconvenient for me that triggers aren't inherited: Foreign keys too (which are a special type of trigger of course). Is this behaviour to be implemented at any point of time in the future? Could it be advisible to write the patch? Or is it just too

Re: [GENERAL] triggers vs b-tree

2007-01-26 Thread Joris Dobbelsteen
I believe you should design it in a slightly different way: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of gustavo halperin Sent: donderdag 25 januari 2007 21:34 To: pgsql-general@postgresql.org Subject: [GENERAL] triggers vs b-tree Hello I have

Re: [GENERAL] triggers vs b-tree

2007-01-26 Thread Tomas Vondra
Hello I have a design question: I have a table representing Families, and a table representing Persons. The table Family have a row family_id as primary key. The table Person have a row person_id as primary key and contain also a row family_id. As you can understand, the row family_id in

[GENERAL] triggers vs b-tree

2007-01-25 Thread gustavo halperin
Hello I have a design question: I have a table representing Families, and a table representing Persons. The table Family have a row family_id as primary key. The table Person have a row person_id as primary key and contain also a row family_id. As you can understand, the row family_id in a

Re: [GENERAL] triggers and TriggerData

2007-01-22 Thread Michael Fuhr
On Sun, Jan 21, 2007 at 09:05:30PM -0800, Alan Hodgson wrote: On Sunday 21 January 2007 15:56, gustavo halperin [EMAIL PROTECTED] wrote: I have another question about triggers, how can I pass arguments ?? I read about some struct TriggerData *CurrentTriggerData, but I didn't found any

Re: [GENERAL] triggers and TriggerData

2007-01-22 Thread Alan Hodgson
On Monday 22 January 2007 07:04, Michael Fuhr [EMAIL PROTECTED] wrote: You can pass literal string arguments to a trigger function. See the CREATE TRIGGER documentation and, for PL/pgSQL, TG_ARGV and TG_NARGS. For C see Writing Trigger Functions in C; search for tgnargs and tgargs.

[GENERAL] triggers and TriggerData

2007-01-21 Thread gustavo halperin
First, thank you for your answers about my problem with the function 'CREATE TRIGGER', I have another question about triggers, how can I pass arguments ?? I read about some struct TriggerData *CurrentTriggerData, but I didn't found any explanation or example about how to use it in postgres SQL.

Re: [GENERAL] triggers and TriggerData

2007-01-21 Thread Alan Hodgson
On Sunday 21 January 2007 15:56, gustavo halperin [EMAIL PROTECTED] wrote: First, thank you for your answers about my problem with the function 'CREATE TRIGGER', I have another question about triggers, how can I pass arguments ?? I read about some struct TriggerData *CurrentTriggerData, but I

Re: [GENERAL] TRIGGERS - access sql query_string that called it?

2006-11-09 Thread Richard Huxton
Matthew Peter wrote: Is it possible to access the entire sql query_string that called the trigger? No. It doesn't necessarily exist in any useful form (think about what happens with rules on a view, or triggers making updates which fire other triggers - what is the original query?). --

[GENERAL] TRIGGERS - access sql query_string that called it?

2006-11-08 Thread Matthew Peter
Is it possible to access the entire sql query_string that called the trigger? Want to start your own business? Learn how on Yahoo! Small Business. http://smallbusiness.yahoo.com/r-index

[GENERAL] [Triggers] Check if OLD or NEW records are NULL

2006-10-26 Thread macieh
Dear All, Can I check if OLD record is NULL in trigger function. I'm using tg_op and check if it's UPDATE, etc. but I need check if OLD record exists. Is it possible? f.i. IF OLD IS NOT NULL THEN IF OLD.identity IS NULL THEN

[GENERAL] Triggers

2006-10-15 Thread Germán Hüttemann Arza
Hello, I have this doubt since I started using PostgreSQL, a few months ago.Why triggers are defined that way? I mean, in others DBMS you simply write:CREATE TRIGGER trigger_name ... bla bla bla BEGIN END;Why you should write a function first and then the trigger, which must call that

Re: [GENERAL] Triggers

2006-10-15 Thread Chris Mair
Why you should write a function first and then the trigger, which must call that function? What are the advantages/disadvantages of that? Where can I find more information? The PG way seems very natural to me: you can write functions that do something and then have many triggers call that

Re: [GENERAL] Triggers

2006-10-15 Thread Tom Lane
Chris Mair [EMAIL PROTECTED] writes: Why you should write a function first and then the trigger, which must call that function? ... there's not just PL/PGSQL: you might want to define a function in C or Perl and then have a trigger call it. Right, that's the real reason: this approach

[GENERAL] Triggers invoking a stored procedure or a C function

2006-08-16 Thread Harpreet Dhaliwal
Hi, Conventionally a trigger would fire a few sql queries on a particular event and we have standard code for that. My requirement is to start a stored procedure or a C function as a trigger action. Is this possible? Thanks, ~Harpreet

Re: [GENERAL] Triggers invoking a stored procedure or a C function

2006-08-16 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-08-16 11:55:39 -0400: Hi, Conventionally a trigger would fire a few sql queries on a particular event and we have standard code for that. My requirement is to start a stored procedure or a C function as a trigger action. Is this possible? Besides the fact

Re: [GENERAL] Triggers in Postgres

2006-08-01 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-07-31 11:58:49 -0400: Actually Postgres manual of triggers says that in postgres, you can't write a trigger in conventional sql. You have to write it in a procedural language like C. So wanted some more insight on it. ~Jas Where does it say so? Do you have a

Re: [GENERAL] Triggers in Postgres

2006-08-01 Thread Jasbinder Bali
http://www.postgresql.org/docs/8.1/interactive/triggers.html it says something like this: It is not currently possible to write a trigger function in the plain SQL function language. though lately I saw triggers written in pure sql in postgres ~jas On 8/1/06, Roman Neuhauser [EMAIL

  1   2   3   >