1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

Fix ALTER LARGE OBJECT and GRANT ... ON LARGE OBJECT for large OIDs.

The previous coding failed for OIDs too large to be represented by
a signed integer.
This commit is contained in:
Robert Haas
2010-06-13 17:43:13 +00:00
parent a079efa641
commit 26b7abfa32
6 changed files with 42 additions and 40 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.76 2010/01/02 16:57:54 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.77 2010/06/13 17:43:13 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@ -303,6 +303,28 @@ oidvectorsend(PG_FUNCTION_ARGS)
return array_send(fcinfo);
}
/*
* oidparse - get OID from IConst/FConst node
*/
Oid
oidparse(Node *node)
{
switch (nodeTag(node))
{
case T_Integer:
return intVal(node);
case T_Float:
/*
* Values too large for int4 will be represented as Float constants
* by the lexer. Accept these if they are valid OID strings.
*/
return oidin_subr(strVal(node), NULL);
default:
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
}
return InvalidOid; /* keep compiler quiet */
}
/*****************************************************************************
* PUBLIC ROUTINES *