473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reparse PL/pgSQL Function?

Is it possible to (automatically) force the reparse of a stored PL/pgSQL
function following the deletion and recreation of an object that was
referenced within the function (for example a table or another function)?

The need to re-create (create or replace ...) the function is a pain as
you have to follow a potential chain of other objects recreating them too.

I think that it would be better if Postgres could (optionally) try
re-parsing the function if it failed to locate a referenced object's OID.
The reparse would allow it to locate the newly created OID (assuming the
object had been recreated), and then operate as before.

I know that someone is going to say that it is safer not to do this
because the error flags the DB in an inconsistant state, but...

Oracle has the concept of a validity flag for stored procs/functions. When
you delete an object, all procs/functions referencing that object are
marked invalid. When you try to execute a function marked invalid, Oracle
reparses and compiles the proc/function the next time it is executed. If
the referenced objects have been recreated, then operation proceeds
normally, and if not, an error is generated.

Could Postgres provide the same behaviour? And if so, how likely is a fix? :)

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
3 1713
On Wed, 7 Jan 2004, John Sidney-Woollett wrote:
Is it possible to (automatically) force the reparse of a stored PL/pgSQL
function following the deletion and recreation of an object that was
referenced within the function (for example a table or another function)?


Would

CREATE OR REPLACE function

work?


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2
My take on the originmal question:
"If function Foo calls functioin Bar and you chanage Bar "sufficiently",
change the prameter list, return type. etc., what would be necessary
to recompile Foo?"

Rick

scott.marlowe wrote:
On Wed, 7 Jan 2004, John Sidney-Woollett wrote:

Is it possible to (automatically) force the reparse of a stored PL/pgSQL
function following the deletion and recreation of an object that was
referenced within the function (for example a table or another function)?


Would

CREATE OR REPLACE function

work?


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #3
It would, but you have to locate all the functions that referenced your
deleted and recreated table... That's the pain.

If you miss one, you find out later when your app dies with an unexpected
error thrown by postgres.

John

scott.marlowe said:
On Wed, 7 Jan 2004, John Sidney-Woollett wrote:
Is it possible to (automatically) force the reparse of a stored PL/pgSQL
function following the deletion and recreation of an object that was
referenced within the function (for example a table or another
function)?


Would

CREATE OR REPLACE function

work?

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stanislaw Findeisen | last post by:
I want to create a reparse point on NTFS (any). Here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/reparse_points.asp) I read: "reparse points are used to implement...
3
by: D. Stimits | last post by:
I've found a number of basic references for PL/PGSQL, but am looking for something more complete. First question, is there available a *complete* reference for PL/PGSQL? I'm using PostgreSQL...
1
by: D. Dante Lorenso | last post by:
I just wrote a PL/PGSQL function that is working, but I don't know why it is... I have a foreign key constraint defined on: transaction.invoice_id --> invoice.invoice_id But I did NOT state...
3
by: Mathias Erlandsson | last post by:
Hi Does anybody know how to create and show a reparse point in c#? I'm able to determine if a folder is a reparse point or not by looking at the file attributes, but how do I get the reparse info...
2
by: Gellert, Andre | last post by:
Hello, I have following problem: A user "xy" shouldn't have any rights to a table, but needs data from the content of the table. My idea was to setup a PL/PGSQL procedure to fetch the data...
1
by: Graeme Hinchliffe | last post by:
Hiya, Not had much experience with tiggers under postgres but am liking them so far. My problem is this. I am writing an updates system, postgres holds the master copy of the database, any...
0
by: Google Mike | last post by:
I had RH9 Linux. It came with pgSQL, but I couldn't seem to figure out how to get PL/pgSQL going. I read the HTML documentation that came with it and was confused until I tried a few different...
0
by: Eric Parusel | last post by:
Hello, I've got a C++ library I need to use, and I want to use it from a pgsql function. Would anyone happen to have any examples of how to accomplish something like this? I see examples of...
0
by: Matt | last post by:
I need an installation with Postgres support, and was happy to find in my phpinfo that there was a --with-pgsql=shared option in the config line. but I still got "call to undefined function:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.