sql - When / how are default value expression functions bound with regard to search_path? -
For testing purposes, I have my now ()
function which is public.now ()
. Works mostly with my own version, but I have a table in which default pg_catalog using
search_path
with the default expression of (now
. Showing table which makes something similar to the following: now). To override now ()
()
start_date | Date | However, after saving a schema and restoring (in test db), generates the same show table start_date | Date | Tap default pg_catalog.now ()
I suppose it, in the beginning, a function in the default expression is not bound to any schema and search_path will be used to find the right one However, the dump or restoration operation seems to "tie the current" to the function.
Is my understanding of the "bind state" of work right? Is there any way to keep the unbound-snap of function in dump / restored bounds?
The default value is parsed on the creation time (initial binding!) Whether you have psql, pgAdmin or others There is a text presentation seen in the client, but in reality, when creating the column default, the OID
function has is now ()
stored in the system catalog. I quote:
ADBIN pg_node_tree column default value of the adsrc text Internal representation of the default value of human-readable representation
When you change, due to Postgres The function causes the schema-eligible name to be displayed, because it will not be resolved correctly with the current search_path
.
Dump and restore your custom search_path
settings when they explicitly set it, then what you are seeing is not related to the dump / restore cycle.
Override the built-in function
Public
to pg_catalog
search_path
in Danger Games . With uncontrolled (or malicious) outcome - Disadvantaged users (including themselves) are often allowed to write them there and to create functions that may inadvertently reverse the system function.
You want restricted access with restricted access To override the underlying work, try something like this instead:
SET search_path = Override, pg_catalog , public;
Details in it.
Comments
Post a Comment