mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
pg_column_size() cleanup for messages and code cleanup.
Mark Kirkwood
This commit is contained in:
parent
eefdbba062
commit
294de2dc01
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.125 2005/07/06 19:02:52 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.126 2005/07/07 04:36:08 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,6 @@
|
|||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
#include "utils/lsyscache.h"
|
#include "utils/lsyscache.h"
|
||||||
#include "utils/pg_locale.h"
|
#include "utils/pg_locale.h"
|
||||||
#include "utils/syscache.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct varlena unknown;
|
typedef struct varlena unknown;
|
||||||
@ -2364,22 +2363,15 @@ pg_column_size(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
/* On the first call lookup the datatype of the supplied argument */
|
/* On the first call lookup the datatype of the supplied argument */
|
||||||
Oid argtypeid = get_fn_expr_argtype(fcinfo->flinfo, 0);
|
Oid argtypeid = get_fn_expr_argtype(fcinfo->flinfo, 0);
|
||||||
HeapTuple tp;
|
int typlen = get_typlen(argtypeid);
|
||||||
int typlen;
|
|
||||||
|
|
||||||
tp = SearchSysCache(TYPEOID,
|
|
||||||
ObjectIdGetDatum(argtypeid),
|
if (typlen == 0)
|
||||||
0, 0, 0);
|
|
||||||
if (!HeapTupleIsValid(tp))
|
|
||||||
{
|
{
|
||||||
/* Oid not in pg_type, should never happen. */
|
/* Oid not in pg_type, should never happen. */
|
||||||
ereport(ERROR,
|
elog(ERROR, "cache lookup failed for type %u", argtypeid);
|
||||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
|
||||||
errmsg("invalid typid: %u", argtypeid)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typlen = ((Form_pg_type)GETSTRUCT(tp))->typlen;
|
|
||||||
ReleaseSysCache(tp);
|
|
||||||
fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||||
sizeof(int));
|
sizeof(int));
|
||||||
*(int *)fcinfo->flinfo->fn_extra = typlen;
|
*(int *)fcinfo->flinfo->fn_extra = typlen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user