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 7492683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:30:56+00:00 2026-05-29T16:30:56+00:00

my problem is easy to explain with an example: I have a ‘common’ schema

  • 0

my problem is easy to explain with an example: I have a ‘common’ schema (the public one?) where I store common data between a clustered application.

For every instance of my application, I have a role (used as the application user).
And i have a common role, app_users, with read-only privileges on the common schema, and every application role is a member of app_users.

Now my problem is: how can i set a trigger on the app_a scheme that execute a function (procedure) in the common scheme, but affect the (and only the) app_a tables?

I mean:

// common_scheme, dummy function to emulate the mysql on update = now()
CREATE OR REPLACEFUNCTION update_etime() RETURNS TRIGGER AS $$
    BEGIN 
    NEW.etime = date_part('epoch'::text, now())::int;
    RETURN NEW;
    END;
$$ language plpgsql;

// now, in the app_foo scheme, i have the table:
CREATE TABLE foo_table (fid serial not null primary key unique, label char(25));
// and the trigger:
CREATE TRIGGER foo_table_update_etime BEFORE UPDATE ON foo_talbe FOR EACH ROW EXECUTE PROCEDURE update_etime();
// ERROR:  function update_etime() does not exist
CREATE TRIGGER foo_table_update_etime BEFORE UPDATE ON foo_talbe FOR EACH ROW EXECUTE PROCEDURE common_scheme.update_etime();
// ERROR:  function common_scheme.update_etime() does not exist

The user that will access app_foo has the execute privilege on update_etime() function in common_schema.

Any idea?

I’ve googled around but the only solution I fount to call functions from other schemas is something like execute 'select * from ' || schema_name || '.table_name'; but i dont think this will do the trick in my case, becose the function must work with the ‘local’ scheme.

  • 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. Editorial Team
    Editorial Team
    2026-05-29T16:31:00+00:00Added an answer on May 29, 2026 at 4:31 pm

    Your second set of syntax should work… the one with “EXECUTE PROCEDURE common_scheme.update_etime();“

    If it isn’t finding the function, I’d guess that you either have created it in a different schema than you think it is in, or you haven’t created it at all (and note, your example create syntax has a bug, no space between “replace” and “function”, which would cause an error when trying to create the function. Try doing a:

    \df *.update_etime
    

    As superuser to verify the function exists and is in the location you think it is in. HTH.

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

Sidebar

Related Questions

The problem is easy to explain: we have two big arrays (32 bit integer
Hopefully this is easy to explain, but I have a lookup transformation in one
I hope this is a relatively easy problem although I have spent hours websearching
It's not easy to explain very well what I'm having problem with so I
I have a scenario which is not easy to explain, but I am sure
I'll try to explain my problem the best I can, here goes: I have
It is not easy to explain the problem without an image and without code.
An easy problem, but for some reason I just can't figure this out today.
This problem is easy fixed clientside. But for performance I want to do it
This should be an easy problem but... I need to format a currency for

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.