Coding help

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Coding help
Дата
Msg-id 3F9B87FD.1020209@familyhealth.com.au
обсуждение исходный текст
Ответы Re: Coding help  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Hi guys,

I've asked this of a few people now, but I haven't managed to get a 
straightforward solution.

I'm working on COMMENT ON LARGE OBJECT.

If you could help me with this one, it would be really cool.  Other than
this, comment on language, conversion, cast and operator class are all done.

This is my grammar snippet.  NumericOnly seems to be the one to use -
that's what CREATE SEQUENCE uses for its large number support, and I
have to support large OIDs I presume.  I could also use IntegerOnly 
perhaps, I don't know:

| COMMENT ON LARGE OBJECT NumericOnly IS comment_text     {         CommentStmt *n = makeNode(CommentStmt);
n->objtype= OBJECT_LARGEOBJECT;         n->objname = makeList1(makeAConst($5));         n->objargs = NIL;
n->comment= $7;         $$ = (Node *) n;     }
 

This is my comment function:

static void
CommentLargeObject(List *qualname, char *comment)
{     /* This is what I cannot figure out - how do I change the Node 
which is the first element in the qualname to an actual Oid type??? */     Oid    loid =
somehow_get_oid_from(lfirst(qualname));    Oid    classoid;
 
     /* check that the large object exists */     if (!LargeObjectExists(loid))         ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),        errmsg("large object %u does not exist", loid)));
 
     classoid = get_system_catalog_relid(LargeObjectRelationName);
     CreateComments(loid, classoid, 0, comment);
}

The problem is extracting the oid from the qualname list.  I just can't
figure it out. I've searched the codebase but there doesn't seem to be
anywhere else that actually does this, like this.

I've tried all sorts of things, but I can't figure it out...

Thanks for any help,

Chris




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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: random access - bytea
Следующее
От: Kurt Roeckx
Дата:
Сообщение: Re: Call for port reports