table creation using backend functions
От | Alice Lottini |
---|---|
Тема | table creation using backend functions |
Дата | |
Msg-id | 20030424181900.27807.qmail@web13706.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: table creation using backend functions
|
Список | pgsql-hackers |
Hi everybody, We've created a dynamically loadable module which reads data by directly invoking the access methods; now we need to create a new table and to write data in it by calling backend functions, as we cannot use SQL statements. Here is our function body: ... /* DUMMY_TUPLE is a tuple of our newly-defined type (whose creation is successful) */ tupdesc=RelationNameGetTupleDesc(DUMMY_TUPLE); /* newtabcreate is our function's name */ namelist=textToQualifiedNameList(relname,"newtabcreate"); rangevar=makeRangeVarFromNameList(namelist); relnamespace=RangeVarGetCreationNamespace(rangevar); if (!IsBootstrapProcessingMode()) { aclresult=pg_namespace_aclcheck(relnamespace,GetUserId(),ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult,get_namespace_name(relnamespace)); } namestring=NameListToString(namelist); reloid=heap_create_with_catalog(namestring,relnamespace,tupdesc,RELKIND_RELATION,false,allowSystemTableMods); CommandCounterIncrement(); result=ObjectIdGetDatum(reloid); ... As we try and execute the function, some fatal error occurs and the server terminates and restarts again. Obviously the table hasn't been created, but the strange thing is that both relnamespace (the namespace Oid) and reloid (the relation oid) seem to be valid (they do not match with the InvalidOid). We've also seen that there is the function DefineRelation which maybe could be useful, but we do not know how to directly fill the CreateStmt structure (in particular: how do we have to set NodeTag and TableElts?). Thanks in advance for your help! alice and lorena ______________________________________________________________________ Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html
В списке pgsql-hackers по дате отправления: