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

  • Home
  • SEARCH
  • 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 8582771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:22:33+00:00 2026-06-11T21:22:33+00:00

Is there anyway from within a plpgsql function that you can get the name

  • 0

Is there anyway from within a plpgsql function that you can get the name of the function? Or even the OID of the function?

I know there are some “special” variables (such as FOUND) within plpgsql, but there doesn’t seem to be any way of getting this. (Although, I’ve read where it seems to be possible if your function is written in C). It’s not critical, but it would make something I’m doing a little nicer/less fragile.

I’m using PostgreSQL v. 9.1.5

  • 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-06-11T21:22:35+00:00Added an answer on June 11, 2026 at 9:22 pm

    For triggers use TG_NAME to get the name of the trigger (not the trigger function) fired.

    You also have current_query() to get the top level query executed by the application, the root cause for your function’s execution. It won’t show you any intermediate functions.

    Otherwise, not really AFAIK and I did go looking for it a while ago when I wanted to print a “current function stack” for debugging. Others may know more.

    UPDATE: In Pg 9.4 and above you can also use PG_CONTEXT to the call stack, but not just the current function name.

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

Sidebar

Related Questions

is there any way to reference a class name from within the class declaration?
Is there any way to get the effect of running python -u from within
Is there anyway to create an ObjectSet from a DbSet ? Some background information:
is there anyway to load other JS files from within a single JS file.
Possible Duplicate: Is there anyway to set values in the settings.bundle from within the
Is there anyway to get Ruby's require statement to download a file from somewhere
Is there anyway to strip or replace or anything like that from one index
I have a WPF application that is run from a shortcut. Is there anyway
Working with COM interop, I can call a managed function from within unmanaged code.
Is there anyway to get the collection URI from IBuildDefinition or other related 'services'.

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.