Regarding the correct and best way to fetching a tablename in contrib module

Поиск
Список
Период
Сортировка
От Gaurav Mishra
Тема Regarding the correct and best way to fetching a tablename in contrib module
Дата
Msg-id CAOCUFr2p7DpZA=4sfyKo9zW5iHXMLo+H=hL9FKeot5ABJYt8KQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Regarding the correct and best way to fetching a tablename incontrib module  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Hi folks ,

I have developed a new data type in PostgreSQL. The handler associated with this data type is written in C language. This handler encrypts the column data. I need help on figuring out how to get the table name when my handler code is called during CRUD and Alter table operations.

let me elaborate a bit about the things i am gonna do here , So the thing is i am developing a cont-rib module and wants to capture table name inside that cont-rib module .

question:

1. Is there any way to capture a table name during CRUD and alter table  ?
I have seen some of the triggers but not able to make it (i don't thing there is any create table trigger exist ). in case If it is possible tell me a way to achieve it.

2. I though of extracting meta-data using pg_class but not helping it seems because i have to give explicitly a  rel-name(table-name) in where clause 
do you think any other way to achieve it ? please elaborate if any and please let me know.

3. Is there any callback functions available so that i can call those callback functions inside a code and if yes at what level we get tablename attached with colname .

Here is some example which will make you understand a bit about the things i am gonna do .

create table new_table(name varchar , new integer) ; 

insert into new_table values('abcdefghijkl' , 5004);

create table new_table1(name1 varchar , new1 integer) ; 

insert into new_table1 values('mnopqrst' , 5005);

So my extension should extact a tablename ,means i should know tablename with the built-in datatype I have declared .

here what i expect as a output :

create extension table_name-extract;

select extract_tablename();

table-name  datatype-name
new_table  name new
new_table1 name1 new1

extract_tablename : this function should give me a table name with data_type inside contrib module so that i can use in the extension .

Any help would be much appropriated .

Thanks and Regards,
Gaurav Mishra
9986425323 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Incorrect fsync handling in pg_basebackup's tar_finish
Следующее
От: Chris Howard
Дата:
Сообщение: Re: comma to delimit fractional seconds