Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 105855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:30:18+00:00 2026-05-11T01:30:18+00:00

I have this Trigger in Postgresql that I can’t just get to work (does

  • 0

I have this Trigger in Postgresql that I can’t just get to work (does nothing). For understanding, there’s how I defined it:

CREATE TABLE documents (     ...     modification_time timestamp with time zone DEFAULT now() );  CREATE FUNCTION documents_update_mod_time() RETURNS trigger AS $$     begin     new.modification_time := now();     return new;     end $$     LANGUAGE plpgsql;  CREATE TRIGGER documents_modification_time     BEFORE INSERT OR UPDATE ON documents     FOR EACH ROW     EXECUTE PROCEDURE documents_update_mod_time(); 

Now to make it a bit more interesting.. How do you debug triggers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:30:18+00:00Added an answer on May 11, 2026 at 1:30 am
    1. Use the following code within a trigger function, then watch the ‘messages’ tab in pgAdmin3 or the output in psql:

      RAISE NOTICE 'myplpgsqlval is currently %', myplpgsqlval;       -- either this RAISE EXCEPTION 'failed';  -- or that 
    2. To see which triggers actually get called, how many times etc, the following statement is the life-saver of choice:

      EXPLAIN ANALYZE UPDATE table SET foo='bar'; -- shows the called triggers 

      Note that if your trigger is not getting called and you use inheritance, it may be that you’ve only defined a trigger on the parent table, whereas triggers are not inherited by child tables automatically.

    3. To step through the function, you can use the debugger built into pgAdmin3, which on Windows is enabled by default; all you have to do is execute the code found in …\8.3\share\contrib\pldbgapi.sql against the database you’re debugging, restart pgAdmin3, right-click your trigger function, hit ‘Set Breakpoint’, and then execute a statement that would cause the trigger to fire, such as the UPDATE statement above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 91k
  • Answers 91k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not sure why you want to do this instead of… May 11, 2026 at 6:18 pm
  • Editorial Team
    Editorial Team added an answer The only reason to use short variable names in JS… May 11, 2026 at 6:18 pm
  • Editorial Team
    Editorial Team added an answer "Plain" char having unspecified signed-ness allows compilers to select whichever… May 11, 2026 at 6:18 pm

Related Questions

I have this Trigger in Postgresql that I can't just get to work (does
I have two tables (in postgres) - ads and logs. After every insert into
I have a migration that runs an SQL script to create a new Postgres
I am trying to implement a request to an unreliable server. The request is
OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.