Skip site navigation (1) Skip section navigation (2)

parser handling of large object OIDs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: parser handling of large object OIDs
Date: 2010-06-09 21:02:12
Message-ID: AANLkTimE0db-r19OOWBZZ7TDr9Teg3R2tz4gJdVOFLH2@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
gram.y treats large object identifiers inconsistently.  The privileges
stuff treats them as IConst:

            | LARGE_P OBJECT_P Iconst_list
                {
                    PrivTarget *n = (PrivTarget *) palloc(sizeof(PrivTarget));
                    n->targtype = ACL_TARGET_OBJECT;
                    n->objtype = ACL_OBJECT_LARGEOBJECT;
                    n->objs = $3;
                    $$ = n;
                }

            | ALTER LARGE_P OBJECT_P Iconst OWNER TO RoleId
                {
                    AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                    n->objectType = OBJECT_LARGEOBJECT;
                    n->object = list_make1(makeInteger($4));
                    n->newowner = $7;
                    $$ = (Node *)n;
                }

But the comment code treats them as NumericOnly.

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

I believe that the comment code is probably right, because I think
IConst can only handle values < 2^31, whereas OIDs can be as large as
2^32-1.

Thoughts?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-06-09 21:24:28
Subject: Re: [BUGS] Server crash while trying to read expression using pg_get_expr()
Previous:From: Simon RiggsDate: 2010-06-09 20:57:50
Subject: Re: How about closing some Open Items?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group