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 CAOCUFr0fv8swAmYKGLj3SFd40dBFjbW0_LbbJDYXi2ezRn_DdQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hi ,

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 contrib module and wants to capture table name inside that contrib 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 new datatype .

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

create table new_table(name varchar , newdata newdatatype) ; 

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

create table new_table1(name1 varchar ,   newdata newdatatype ) ; 

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

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  newdatatype  
new_table1 newdatatype

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

Any help would be much appropriated .

Thanks and Regards,
Gaurav Mishra

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

Предыдущее
От: Kuntal Ghosh
Дата:
Сообщение: Re: Incorrect fsync handling in pg_basebackup's tar_finish
Следующее
От: Lætitia Avrot
Дата:
Сообщение: Re: Constraint documentation