adding a function to pg_proc.h - Mailing list pgsql-hackers

From Jaime Casanova
Subject adding a function to pg_proc.h
Date
Msg-id c2d9e70e05052515482f8744a3@mail.gmail.com
Whole thread Raw
Responses Re: adding a function to pg_proc.h
List pgsql-hackers
I have added a function in sources and added appropiate lines in pg_proc.h

DATA(insert OID = 2560 ( get_view_column_default    PGNSP PGUID 12 f f
t f i 1 2283 "25 25 21" _null_ _null_ _null_ get_view_column_default -
_null_));
DESCR("get default value for view column");

then make; make install; and initdb the data directory.

When i start postgres i look for the function using:

\df get_view*
                              List of functions  Schema   |          Name           | Result data type | Argument data
types  
------------+-------------------------+------------------+----------------------pg_catalog | get_view_column_default |
anyelement      | text, text, smallint 
(1 row)

So far, so good... I will do a test

create table foo (col1    serial,col2    int2
);
NOTICE:  CREATE TABLE will create implicit sequence "foo_col1_seq" for
serial column "foo.col1"

create view v_foo as select * from foo;
NOTICE:  CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules

alter table v_foo alter col1 set default
get_view_column_default('public'::text, 'foo'::text, 1::smallint);
ERROR:  function get_view_column_default(text, text, smallint) does not exist
HINT:  No function matches the given name and argument types. You may
need to add explicit type casts.


So the question is why ERROR message tell the function doesn't exist,
as you can see the function actually exists.
I change the return data type to bigint and got the same error so it
seems is not a problem of returning anyelement.

any comments will be appreciated.

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: WAL replay failure after file truncation(?)
Next
From: Tom Lane
Date:
Subject: Re: adding a function to pg_proc.h