FAQ
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

Search Discussions

  • Robert Haas at Jun 10, 2010 at 12:45 am

    On Wed, Jun 9, 2010 at 5:02 PM, Robert Haas wrote:
    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.
    I investigated this a little more and the above analysis turns out to
    be correct. ALTER LARGE OBJECT OWNER and GRANT ... ON LARGE OBJECT
    don't work for large objects outside the range of a signed integer.
    Session demonstrating the problem and proposed patch attached.

    --
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
  • Tom Lane at Jun 10, 2010 at 2:26 am

    Robert Haas writes:
    On Wed, Jun 9, 2010 at 5:02 PM, Robert Haas wrote:
    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.
    I investigated this a little more and the above analysis turns out to
    be correct. ALTER LARGE OBJECT OWNER and GRANT ... ON LARGE OBJECT
    don't work for large objects outside the range of a signed integer. Yup.
    Session demonstrating the problem and proposed patch attached.
    This patch seems extremely grotty, though. Surely that's not the way we
    were doing it in the comment code?

    regards, tom lane
  • Robert Haas at Jun 10, 2010 at 11:09 am

    On Wed, Jun 9, 2010 at 10:26 PM, Tom Lane wrote:
    Robert Haas <robertmhaas@gmail.com> writes:
    On Wed, Jun 9, 2010 at 5:02 PM, Robert Haas wrote:
    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.
    I investigated this a little more and the above analysis turns out to
    be correct.  ALTER LARGE OBJECT OWNER and GRANT ... ON LARGE OBJECT
    don't work for large objects outside the range of a signed integer. Yup.
    Session demonstrating the problem and proposed patch attached.
    This patch seems extremely grotty, though.  Surely that's not the way we
    were doing it in the comment code?
    I pretty much just moved the existing code from CommentLargeObject()
    into a new function oidparse(). I couldn't really figure out where to
    put the oidparse() function so I eventually decided on oid.c, and
    therefore also ripped out the trip through the fmgr layer in favor of
    calling the appropriate code directly. Other than that it's the same
    code. I'm open to suggestions, but this is basically just a small bit
    of code rearrangement.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJun 10, '10 at 12:42a
activeJun 10, '10 at 11:09a
posts4
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Robert Haas: 3 posts Tom Lane: 1 post

People

Translate

site design / logo © 2022 Grokbase