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 mai

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 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 Postgres 9.4, > the production se

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 exte

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 acc

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

2015-02-26 Thread Jerry Sievers
Tim Uckun 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 people sugges

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 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 queue problem

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

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: h

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

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 wrote: > the later ,in same db > > jov > 在 2013-7-5 下午4:32,"itishree sukla" 写道: > > Hello Every one, >> >> Is Postgresql providing triggers on DB level, s

Re: [GENERAL] Triggers

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

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 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 > > > Requ

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 ca

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 appli

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
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. 2011/3/18 David Johnston : > Don't know if this would work but could you che

Re: [GENERAL] triggers and FK cascades

2011-03-17 Thread David Johnston
Don't know if this would work but could you check to see if the corresponding PK exists on A? It may also help to explain why you would want to do such a thing so that someone may be able to provide an alternative solution as opposed to simply responding to a generic feature question. David

Re: [GENERAL] Triggers and locking

2010-09-21 Thread William Temperley
On 21 September 2010 18:39, Alban Hertroys 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.: >> """ >> update

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

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'

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||' value

Re: [GENERAL] triggers and execute...

2009-05-01 Thread Scott Marlowe
On Tue, Apr 28, 2009 at 10:46 PM, David Fetter 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 >> wrote: >> > On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe >> > wrote: >> >> OK, I'm hitting a wall here.  I've written

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 Los

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Scott Marlowe
On Wed, Apr 29, 2009 at 4:23 AM, Alban Hertroys 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 nightmare.  I had built something lik

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 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 > wrote: > > On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe > > wrote: > >> OK, I'm hitting a wall here.  I've written this trigger for partitioning: > >> > >> create or replace fun

Re: [GENERAL] triggers and execute...

2009-04-30 Thread Scott Marlowe
On Tue, Apr 28, 2009 at 11:24 PM, Scott Marlowe wrote: > On Tue, Apr 28, 2009 at 10:46 PM, David Fetter 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 >>> wrote: >>> > On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe

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 = to_char(new."tim

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 wrote: On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma wrote: On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe > wrote: OK, I'm hitting a wall here. I've written this trigger for partitioning: create or replace

Re: [GENERAL] triggers and execute...

2009-04-29 Thread Jasen Betts
On 2009-04-29, Scott Marlowe wrote: > On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma > wrote: >> On Mon, Apr 27, 2009 at 1:32 PM, 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

Re: [GENERAL] triggers and execute...

2009-04-28 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma wrote: > On Mon, Apr 27, 2009 at 1:32 PM, 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 >>  

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.

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma wrote: > On Mon, Apr 27, 2009 at 1:32 PM, 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 >>  

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Richard Broersma
On Mon, Apr 27, 2009 at 1:32 PM, 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 = to_char(new.

Re: [GENERAL] triggers and execute...

2009-04-27 Thread Scott Marlowe
On Mon, Apr 27, 2009 at 2:32 PM, 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 = to_char(new.

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 y

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'; >

Re: [GENERAL] triggers problems whit function

2008-10-22 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

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 mai

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] > > > > 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

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

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 >

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 chi

Re: [GENERAL] Triggers not working

2008-09-22 Thread Dale Harris
t: Re: [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 p

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

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

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 enregist

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 TD['new'].items

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: plpy.no

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 |T

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

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 trigg

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: H

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: T

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 questio

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 >

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 partitioning

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 easy

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_

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 ha

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. >

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 a

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,

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?). --

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

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 t

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 th

Re: [GENERAL] Triggers in Postgres

2006-08-01 Thread Tom Lane
Chris Mair <[EMAIL PROTECTED]> writes: >> http://www.postgresql.org/docs/8.1/interactive/triggers.html >> " It is not currently possible to write a trigger function in the >> plain SQL function language. " > The whole paragraph says. > "It is also possible to write a trigger function in C, althou

Re: [GENERAL] Triggers in Postgres

2006-08-01 Thread Chris Mair
> 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. " The whole paragraph says. "It is also possible to write a trigger function in C, although mos

Re: [GENERAL] Triggers in Postgres

2006-08-01 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-08-01 02:35:48 -0400: > On 8/1/06, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > > > ># [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

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 PR

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-07-31 Thread Richard Huxton
Jasbinder Bali wrote: 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. See chapters 35 - 39 of the manual for details. In particular a discussion

Re: [GENERAL] Triggers in Postgres

2006-07-31 Thread Jasbinder Bali
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  On 7/31/06, Tino Wildenhain <[EMAIL PROTECTED]> wrote: Jasbinder Bali wrote:> Hi,> Was wondering

Re: [GENERAL] Triggers in Postgres

2006-07-31 Thread Tino Wildenhain
Jasbinder Bali wrote: > Hi, > Was wondering if one can write triggers with SQL statements as we have > in other RDBMS like SQL Server and oracle. What would such a trigger "in SQL statements" look like? SQL Server has Triggers in Transact-SQL, which is just something like a pl/language. > Can the

Re: [GENERAL] Triggers in C - Segmentation Fault

2006-05-15 Thread Martijn van Oosterhout
The core file usually appears in the data directory of the backend. If you still can't find it, you can try attaching gdb to the running backend. After the connection has started, find the backend (not the postmaster) and attach using: gdb -p Once connected, type "cont" and proceed with the act

Re: [GENERAL] Triggers in C - Segmentation Fault

2006-05-15 Thread Chris Coleman
Hi, I have done the below command and restarted the server and built my triggers with the -g command using gcc, but I cannot seem to find any core files nor any reference to where postgres may place them. Where would they normally appear? Cheers Chris Probably the easiest thing to do is make s

Re: [GENERAL] Triggers in C - Segmentation Fault

2006-05-12 Thread Martijn van Oosterhout
On Thu, May 11, 2006 at 10:28:37AM +0100, Chris Coleman wrote: > Hi, > > I have written a couple of trigger functions in C that utilise the SPI > interface. They are both row level triggers, one a before trigger and > one an after trigger. > > If the triggers are called with an update statement

Re: [GENERAL] Triggers and Transactions

2006-04-21 Thread Terry Lee Tucker
On Thursday 20 April 2006 12:25 pm, "Chris Coleman" <[EMAIL PROTECTED]> thus communicated: --> Hi, --> --> I have a question about how much of a trigger is in a transaction. --> I've read the docs and googled around but can't seem to find a --> concrete answer. --> --> I have two triggers that are

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Paul Newman
zales; Scott Marlowe; pgsql general Subject: Re: [GENERAL] Triggers and Multiple Schemas. On Wed, Mar 08, 2006 at 11:16:55PM -, Paul Newman wrote: > So how can I get the schema name of the calling table trigger and use it > in the form of set Search_path at the beginning of the function ?

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Michael Fuhr
On Wed, Mar 08, 2006 at 11:16:55PM -, Paul Newman wrote: > So how can I get the schema name of the calling table trigger and use it > in the form of set Search_path at the beginning of the function ? Here's an example: CREATE FUNCTION trigfunc() RETURNS trigger AS $$ DECLARE schemaname t

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Paul Newman
-Original Message- From: Louis Gonzales [mailto:[EMAIL PROTECTED] Sent: 08 March 2006 20:43 To: Scott Marlowe Cc: Paul Newman; pgsql general Subject: Re: [GENERAL] Triggers and Multiple Schemas. Paul, What is the current schema layout for your db instances? I don't think it's possibl

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Richard Huxton
Paul Newman wrote: Hi, We run with multiple identical schemas in our db. Each schema actually represents a clients db. What we'd like to do is have a common schema where trigger functions and the like are held whilst each trigger defined against the tables is in there own particular schema. Thi

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Louis Gonzales
Paul, What is the current schema layout for your db instances? I don't think it's possible to share across db instances like this: dbname1.myschema.sometable dbname2.myschema.sometable But you can share resources of the following type: dbname.myschema1.sometable dbname.myschema2.sometable db

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Michael Fuhr
On Tue, Mar 07, 2006 at 06:34:33AM -, Paul Newman wrote: > However at the moment we are placing the trigger functions within each > schema along with trigger itself. The reason is that we don't know of a > function or a variable that says "Give me the schema of the trigger that > is calling thi

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Scott Marlowe
On Wed, 2006-03-08 at 14:32, Louis Gonzales wrote: > Scott Marlowe wrote: > > On Wed, 2006-03-08 at 14:19, Louis Gonzales wrote: > > > > > > > Paul, > > > When you say "multiple identical schemas" are they all separate > > > explicit schemas? Or are they all under a general 'public' schema. >

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Louis Gonzales
Scott Marlowe wrote: On Wed, 2006-03-08 at 14:19, Louis Gonzales wrote: Paul, When you say "multiple identical schemas" are they all separate explicit schemas? Or are they all under a general 'public' schema. >From my understanding, when you create a new db instance, it's under t

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Scott Marlowe
On Wed, 2006-03-08 at 14:19, Louis Gonzales wrote: > > > Paul, > When you say "multiple identical schemas" are they all separate > explicit schemas? Or are they all under a general 'public' schema. > From my understanding, when you create a new db instance, it's under > the public level schema b

Re: [GENERAL] Triggers and Multiple Schemas.

2006-03-08 Thread Louis Gonzales
Paul Newman wrote: Hi,  We run with multiple identical schemas in our db. Each schema actually represents a clients db. What we’d like to do is have a common schema where trigger functions and the like are held whilst each trigger defined against the tables is in there own part

Re: [GENERAL] Triggers question

2006-03-01 Thread Michael Fuhr
On Wed, Mar 01, 2006 at 02:22:15PM +0100, [EMAIL PROTECTED] wrote: > I want to setup a trigger capable to return more than one record. Your example doesn't show anything related to triggers so I think you mean "function" instead of "trigger." If the function can return more than one row then it's

Re: [GENERAL] triggers, rules and alter table

2006-02-01 Thread Richard Huxton
Sergey Karin wrote: Hi, List! I'm using pg 8.1.0 this version allows to create triggers on INSERT, DELETE and UPDATE and also allows to create rules on SELECT, UPDATE, INSERT and DELETE. But I want to do some actions on ALTER TABLE ... ADD COLUMN and ALTER TABLE ... DROP COLUMN events. How I ca

Re: [GENERAL] triggers and SELECT

2006-02-01 Thread Tino Wildenhain
Sergey Karin schrieb: Hi, List! Are there any plans to realize triggers on SELECT in new versions of PG? What should they do? You can always use a rule for this... ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Triggers and Audit Trail

2005-12-29 Thread Eric E
Hi Marcus, Marcus Couto wrote: Hi all. I'm new with PostgreSQL and this is my first post, so easy on me... :)   I'm thinking of using the native procedural language and triggers to keep an audit trail. For editing changes, we only keep a log of the modified fields and we create

Re: [GENERAL] Triggers and Audit Trail

2005-12-29 Thread Michael Fuhr
On Thu, Dec 29, 2005 at 11:44:26AM -0600, Jeff Amiel wrote: > >Using triggers, is there a way to loop through the fields of the OLD > >and NEW records? I haven't found a generic way to get the field name > >and value that triggered the update other than hard coding if > >statements to compare ev

Re: [GENERAL] Triggers and Audit Trail

2005-12-29 Thread Jeff Amiel
We (my company) never found a way. We ended up writing java code that analyzed the catalog tables that generated the appropriate 'if' statements in the trigger functions for us Actuallywe tinkered with hitting the catalog tables inside our triggers, but for performance reasons, we

Re: [GENERAL] Triggers and Audit Trail

2005-12-29 Thread Jeff Amiel
Using triggers, is there a way to loop through the fields of the OLD and NEW records? I haven't found a generic way to get the field name and value that triggered the update other than hard coding if statements to compare every field of the OLD and NEW records. We (my company) never found a

Re: [GENERAL] triggers/constraints?

2005-10-08 Thread Terry Lee Tucker
I believe you have a design problem. It seems to me that you need two tables; one with (id, path) and the other with (parent_id, path). Then you can use an UPDATE trigger on item which checks for a change in path. If it has changed, then you can update all those records in table "item2" where it

Re: [GENERAL] Triggers after a rule

2005-09-29 Thread Jan Wieck
On 9/28/2005 5:44 AM, Wijnand Wiersma wrote: Hi list, I am currently trying to give normal users some read access to some tables in the database. I also need to give update access to one column of one table. I have the table contact, the user should not be able to read or update anything in it

Re: [GENERAL] Triggers after a rule

2005-09-28 Thread Wijnand Wiersma
2005/9/28, Richard Huxton : > The solution is to mark your trigger functions with the "SECURITY > DEFINER" attribute and create them as a user who can access relation > "contact". > http://www.postgresql.org/docs/8.0/static/sql-createfunction.html Damn, I really really missed that one :-( Thank yo

Re: [GENERAL] Triggers after a rule

2005-09-28 Thread Richard Huxton
Wijnand Wiersma wrote: 2005/9/28, Richard Huxton : Wijnand Wiersma wrote: I thought that when a rule is applied the triggers which are triggerd would also have the same userid as the rule query, but I was wrong. Can you show the (cut down) contents of your trigger? It's difficult to see wha

  1   2   >