CreateFunction Statement

Started by Praveen Mabout 10 years ago3 messages
#1Praveen M
thrinz@gmail.com

Hi All,

I am trying to get the schema name of the create function call from the
parse tree. When I look at the structure of the CreateFunctionStmt , I do
not see the schemaname information . Can you please help me to understand
how to extract the schema name for the function.

typedef struct CreateFunctionStmt
{
NodeTag type;
bool replace; /* T => replace if already exists */
List *funcname; /* qualified name of function to create */
List *parameters; /* a list of FunctionParameter */
TypeName *returnType; /* the return type */
List *options; /* a list of DefElem */
List *withClause; /* a list of DefElem */
} CreateFunctionStmt;

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Praveen M (#1)
Re: CreateFunction Statement

Hi

2015-11-21 7:09 GMT+01:00 Praveen M <thrinz@gmail.com>:

Hi All,

I am trying to get the schema name of the create function call from the
parse tree. When I look at the structure of the CreateFunctionStmt , I do
not see the schemaname information . Can you please help me to understand
how to extract the schema name for the function.

typedef struct CreateFunctionStmt
{
NodeTag type;
bool replace; /* T => replace if already exists */
List *funcname; /* qualified name of function to create */
List *parameters; /* a list of FunctionParameter */
TypeName *returnType; /* the return type */
List *options; /* a list of DefElem */
List *withClause; /* a list of DefElem */
} CreateFunctionStmt;

The funcname field is >>list of names<<. Look on makeRangeVarFromNameList
function. It is good example.

Regards

Pavel

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Pavel Stehule (#2)
Re: CreateFunction Statement

Pavel Stehule wrote:

Hi

2015-11-21 7:09 GMT+01:00 Praveen M <thrinz@gmail.com>:

Hi All,

I am trying to get the schema name of the create function call from the
parse tree. When I look at the structure of the CreateFunctionStmt , I do
not see the schemaname information . Can you please help me to understand
how to extract the schema name for the function.

The funcname field is >>list of names<<. Look on makeRangeVarFromNameList
function. It is good example.

Of course, if your CREATE FUNCTION statement doesn't have the schema,
there is no way to know from the parsetree. This is where the deparse
infrastructure comes in, see commit b488c580aef.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers