From: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Coding help |
Date: | 2003-10-26 08:38:21 |
Message-ID: | 3F9B87FD.1020209@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Kurt Roeckx | 2003-10-26 10:41:56 | Re: Call for port reports |
Previous Message | Christopher Kings-Lynne | 2003-10-26 08:32:49 | Re: random access - bytea |