1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Add a bunch of pseudo-types to replace the behavior formerly associated

with OPAQUE, as per recent pghackers discussion.  I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
This commit is contained in:
Tom Lane
2002-08-22 00:01:51 +00:00
parent 606c9b9d4f
commit b663f3443b
126 changed files with 2005 additions and 1205 deletions

View File

@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.62 2002/06/20 20:29:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.63 2002/08/22 00:01:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,10 +17,10 @@
#include "access/heapam.h"
#include "access/printtup.h"
#include "catalog/pg_type.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"
static void printtup_setup(DestReceiver *self, int operation,
const char *portalName, TupleDesc typeinfo);
@@ -33,31 +33,6 @@ static void printtup_cleanup(DestReceiver *self);
* ----------------------------------------------------------------
*/
/* ----------------
* getTypeOutputInfo -- get info needed for printing values of a type
* ----------------
*/
bool
getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
bool *typIsVarlena)
{
HeapTuple typeTuple;
Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID,
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "getTypeOutputInfo: Cache lookup of type %u failed", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
*typOutput = pt->typoutput;
*typElem = pt->typelem;
*typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
ReleaseSysCache(typeTuple);
return OidIsValid(*typOutput);
}
/* ----------------
* Private state for a printtup destination object
* ----------------

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.74 2002/08/07 21:45:01 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.75 2002/08/22 00:01:41 tgl Exp $
*
* NOTES
* See acl.h.
@@ -376,7 +376,7 @@ ExecuteGrantStmt_Function(GrantStmt *stmt)
char replaces[Natts_pg_proc];
oid = LookupFuncNameTypeNames(func->funcname, func->funcargs,
true, stmt->is_grant ? "GRANT" : "REVOKE");
stmt->is_grant ? "GRANT" : "REVOKE");
relation = heap_openr(ProcedureRelationName, RowExclusiveLock);
tuple = SearchSysCache(PROCOID,

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.53 2002/08/05 03:29:16 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.54 2002/08/22 00:01:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,13 +67,13 @@ AggregateCreate(const char *aggName,
/* handle transfn */
MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
fnArgs[0] = aggTransType;
if (OidIsValid(aggBaseType))
if (aggBaseType == ANYOID)
nargs = 1;
else
{
fnArgs[1] = aggBaseType;
nargs = 2;
}
else
nargs = 1;
transfn = LookupFuncName(aggtransfnName, nargs, fnArgs);
if (!OidIsValid(transfn))
func_error("AggregateCreate", aggtransfnName, nargs, fnArgs, NULL);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.75 2002/08/05 03:29:16 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.76 2002/08/22 00:01:41 tgl Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -464,9 +464,9 @@ OperatorCreate(const char *operatorName,
if (restrictionName)
{
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
typeId[0] = 0; /* Query (opaque type) */
typeId[0] = INTERNALOID; /* Query */
typeId[1] = OIDOID; /* operator OID */
typeId[2] = 0; /* args list (opaque type) */
typeId[2] = INTERNALOID; /* args list */
typeId[3] = INT4OID; /* varRelid */
restOid = LookupFuncName(restrictionName, 4, typeId);
@@ -482,9 +482,9 @@ OperatorCreate(const char *operatorName,
if (joinName)
{
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
typeId[0] = 0; /* Query (opaque type) */
typeId[0] = INTERNALOID; /* Query */
typeId[1] = OIDOID; /* operator OID */
typeId[2] = 0; /* args list (opaque type) */
typeId[2] = INTERNALOID; /* args list */
joinOid = LookupFuncName(joinName, 3, typeId);
if (!OidIsValid(joinOid))

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.88 2002/08/05 03:29:16 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.89 2002/08/22 00:01:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -502,7 +502,8 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
elog(ERROR, "there is no built-in function named \"%s\"", prosrc);
ReleaseSysCache(tuple);
PG_RETURN_BOOL(true);
PG_RETURN_VOID();
}
@@ -545,9 +546,9 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
(void) fetch_finfo_record(libraryhandle, prosrc);
ReleaseSysCache(tuple);
PG_RETURN_BOOL(true);
}
PG_RETURN_VOID();
}
/*
@@ -567,6 +568,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
Datum tmp;
char *prosrc;
char functyptype;
int i;
tuple = SearchSysCache(PROCOID, funcoid, 0, 0, 0);
if (!HeapTupleIsValid(tuple))
@@ -574,8 +576,19 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
proc = (Form_pg_proc) GETSTRUCT(tuple);
if (!OidIsValid(proc->prorettype))
elog(ERROR, "SQL functions cannot return type \"opaque\"");
/* Disallow pseudotypes in arguments and result */
/* except that return type can be RECORD */
if (get_typtype(proc->prorettype) == 'p' &&
proc->prorettype != RECORDOID)
elog(ERROR, "SQL functions cannot return type %s",
format_type_be(proc->prorettype));
for (i = 0; i < proc->pronargs; i++)
{
if (get_typtype(proc->proargtypes[i]) == 'p')
elog(ERROR, "SQL functions cannot have arguments of type %s",
format_type_be(proc->proargtypes[i]));
}
tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
if (isnull)
@@ -590,5 +603,6 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
checkretval(proc->prorettype, functyptype, querytree_list);
ReleaseSysCache(tuple);
PG_RETURN_BOOL(true);
PG_RETURN_VOID();
}

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.3 2002/07/12 18:43:15 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.4 2002/08/22 00:01:41 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -28,6 +28,7 @@
#include "catalog/namespace.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "miscadmin.h"
#include "parser/parse_func.h"
@@ -104,29 +105,23 @@ DefineAggregate(List *names, List *parameters)
elog(ERROR, "Define: \"sfunc\" unspecified");
/*
* Handle the aggregate's base type (input data type). This can be
* specified as 'ANY' for a data-independent transition function, such
* as COUNT(*).
* look up the aggregate's base type (input datatype) and transtype.
*
* We have historically allowed the command to look like basetype = 'ANY'
* so we must do a case-insensitive comparison for the name ANY. Ugh.
*
* basetype can be a pseudo-type, but transtype can't, since we need
* to be able to store values of the transtype.
*/
baseTypeId = LookupTypeName(baseType);
if (OidIsValid(baseTypeId))
{
/* no need to allow aggregates on as-yet-undefined types */
if (!get_typisdefined(baseTypeId))
elog(ERROR, "Type \"%s\" is only a shell",
TypeNameToString(baseType));
}
if (strcasecmp(TypeNameToString(baseType), "ANY") == 0)
baseTypeId = ANYOID;
else
{
char *typnam = TypeNameToString(baseType);
baseTypeId = typenameTypeId(baseType);
if (strcasecmp(typnam, "ANY") != 0)
elog(ERROR, "Type \"%s\" does not exist", typnam);
baseTypeId = InvalidOid;
}
/* handle transtype --- no special cases here */
transTypeId = typenameTypeId(transType);
if (get_typtype(transTypeId) == 'p')
elog(ERROR, "Aggregate transition datatype cannot be %s",
format_type_be(transTypeId));
/*
* Most of the argument-checking is done inside of AggregateCreate
@@ -159,14 +154,13 @@ RemoveAggregate(RemoveAggrStmt *stmt)
* if a basetype is passed in, then attempt to find an aggregate for
* that specific type.
*
* else if the basetype is blank, then attempt to find an aggregate with
* a basetype of zero. This is valid. It means that the aggregate is
* to apply to all basetypes (eg, COUNT).
* else attempt to find an aggregate with a basetype of ANYOID.
* This means that the aggregate is to apply to all basetypes (eg, COUNT).
*/
if (aggType)
basetypeID = typenameTypeId(aggType);
else
basetypeID = InvalidOid;
basetypeID = ANYOID;
procOid = find_aggregate_func("RemoveAggregate", aggName, basetypeID);

View File

@@ -7,7 +7,7 @@
* Copyright (c) 1996-2001, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.56 2002/08/09 16:45:14 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.57 2002/08/22 00:01:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,6 +24,7 @@
#include "catalog/pg_operator.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "commands/comment.h"
#include "commands/dbcommands.h"
#include "miscadmin.h"
@@ -628,7 +629,7 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
if (aggtype)
baseoid = typenameTypeId(aggtype);
else
baseoid = InvalidOid;
baseoid = ANYOID;
/* Now, attempt to find the actual tuple in pg_proc */
@@ -661,7 +662,7 @@ CommentProc(List *function, List *arguments, char *comment)
/* Look up the procedure */
oid = LookupFuncNameTypeNames(function, arguments,
true, "CommentProc");
"CommentProc");
/* Now, validate the user's ability to comment on this function */

View File

@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
* conversionmacmds.c
* conversioncmds.c
* conversion creation command support code
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.2 2002/07/25 10:07:11 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.3 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ CreateConversionCommand(CreateConversionStmt *stmt)
const char *to_encoding_name = stmt->to_encoding_name;
List *func_name = stmt->func_name;
static Oid funcargs[] = {INT4OID, INT4OID, 0, 0, INT4OID};
static Oid funcargs[] = {INT4OID, INT4OID, CSTRINGOID, CSTRINGOID, INT4OID};
/* Convert list of names to a name and namespace */
namespaceId = QualifiedNameGetCreationNamespace(stmt->conversion_name, &conversion_name);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.165 2002/08/19 15:08:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.166 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,6 +37,7 @@
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/relcache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#ifdef MULTIBYTE

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.17 2002/08/11 17:44:12 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.18 2002/08/22 00:01:42 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -61,7 +61,9 @@
* allow a shell type to be used, or even created if the specified return type
* doesn't exist yet. (Without this, there's no way to define the I/O procs
* for a new type.) But SQL function creation won't cope, so error out if
* the target language is SQL.
* the target language is SQL. (We do this here, not in the SQL-function
* validator, so as not to produce a WARNING and then an ERROR for the same
* condition.)
*/
static void
compute_return_type(TypeName *returnType, Oid languageOid,
@@ -76,7 +78,8 @@ compute_return_type(TypeName *returnType, Oid languageOid,
if (!get_typisdefined(rettype))
{
if (languageOid == SQLlanguageId)
elog(ERROR, "SQL functions cannot return shell types");
elog(ERROR, "SQL function cannot return shell type \"%s\"",
TypeNameToString(returnType));
else
elog(WARNING, "Return type \"%s\" is only a shell",
TypeNameToString(returnType));
@@ -85,29 +88,32 @@ compute_return_type(TypeName *returnType, Oid languageOid,
else
{
char *typnam = TypeNameToString(returnType);
Oid namespaceId;
AclResult aclresult;
char *typname;
if (strcmp(typnam, "opaque") == 0)
rettype = InvalidOid;
else
{
Oid namespaceId;
AclResult aclresult;
char *typname;
/*
* Only C-coded functions can be I/O functions. We enforce this
* restriction here mainly to prevent littering the catalogs with
* shell types due to simple typos in user-defined function
* definitions.
*/
if (languageOid != INTERNALlanguageId &&
languageOid != ClanguageId)
elog(ERROR, "Type \"%s\" does not exist", typnam);
if (languageOid == SQLlanguageId)
elog(ERROR, "Type \"%s\" does not exist", typnam);
elog(WARNING, "ProcedureCreate: type %s is not yet defined",
typnam);
namespaceId = QualifiedNameGetCreationNamespace(returnType->names,
&typname);
aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(),
ACL_CREATE);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, get_namespace_name(namespaceId));
rettype = TypeShellMake(typname, namespaceId);
if (!OidIsValid(rettype))
elog(ERROR, "could not create type %s", typnam);
}
/* Otherwise, go ahead and make a shell type */
elog(WARNING, "ProcedureCreate: type %s is not yet defined",
typnam);
namespaceId = QualifiedNameGetCreationNamespace(returnType->names,
&typname);
aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(),
ACL_CREATE);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, get_namespace_name(namespaceId));
rettype = TypeShellMake(typname, namespaceId);
if (!OidIsValid(rettype))
elog(ERROR, "could not create type %s", typnam);
}
*prorettype_p = rettype;
@@ -138,25 +144,24 @@ compute_parameter_types(List *argTypes, Oid languageOid,
if (OidIsValid(toid))
{
if (!get_typisdefined(toid))
elog(WARNING, "Argument type \"%s\" is only a shell",
TypeNameToString(t));
{
/* As above, hard error if language is SQL */
if (languageOid == SQLlanguageId)
elog(ERROR, "SQL function cannot accept shell type \"%s\"",
TypeNameToString(t));
else
elog(WARNING, "Argument type \"%s\" is only a shell",
TypeNameToString(t));
}
}
else
{
char *typnam = TypeNameToString(t);
if (strcmp(typnam, "opaque") == 0)
{
if (languageOid == SQLlanguageId)
elog(ERROR, "SQL functions cannot have arguments of type \"opaque\"");
toid = InvalidOid;
}
else
elog(ERROR, "Type \"%s\" does not exist", typnam);
elog(ERROR, "Type \"%s\" does not exist",
TypeNameToString(t));
}
if (t->setof)
elog(ERROR, "functions cannot accept set arguments");
elog(ERROR, "Functions cannot accept set arguments");
parameterTypes[parameterCount++] = toid;
}
@@ -492,7 +497,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
* Find the function, do permissions and validity checks
*/
funcOid = LookupFuncNameTypeNames(functionName, argTypes,
true, "RemoveFunction");
"RemoveFunction");
tup = SearchSysCache(PROCOID,
ObjectIdGetDatum(funcOid),
@@ -621,6 +626,23 @@ CreateCast(CreateCastStmt *stmt)
if (sourcetypeid == targettypeid)
elog(ERROR, "source data type and target data type are the same");
/* No shells, no pseudo-types allowed */
if (!get_typisdefined(sourcetypeid))
elog(ERROR, "source data type %s is only a shell",
TypeNameToString(stmt->sourcetype));
if (!get_typisdefined(targettypeid))
elog(ERROR, "target data type %s is only a shell",
TypeNameToString(stmt->targettype));
if (get_typtype(sourcetypeid) == 'p')
elog(ERROR, "source data type %s is a pseudo-type",
TypeNameToString(stmt->sourcetype));
if (get_typtype(targettypeid) == 'p')
elog(ERROR, "target data type %s is a pseudo-type",
TypeNameToString(stmt->targettype));
if (!pg_type_ownercheck(sourcetypeid, GetUserId())
&& !pg_type_ownercheck(targettypeid, GetUserId()))
elog(ERROR, "must be owner of type %s or type %s",
@@ -642,7 +664,6 @@ CreateCast(CreateCastStmt *stmt)
{
funcid = LookupFuncNameTypeNames(stmt->func->funcname,
stmt->func->funcargs,
false,
"CreateCast");
tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid), 0, 0, 0);

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.3 2002/08/05 03:29:16 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.4 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,7 +177,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
elog(ERROR, "DefineOpClass: procedure number %d appears more than once",
item->number);
funcOid = LookupFuncNameTypeNames(item->name, item->args,
true, "DefineOpClass");
"DefineOpClass");
/* Caller must have execute permission on functions */
aclresult = pg_proc_aclcheck(funcOid, GetUserId(),
ACL_EXECUTE);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.40 2002/08/13 17:22:08 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.41 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,17 +71,18 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
elog(ERROR, "Language %s already exists", languageName);
/*
* Lookup the PL handler function and check that it is of return type
* Opaque
* Lookup the PL handler function and check that it is of the expected
* return type
*/
MemSet(typev, 0, sizeof(typev));
procOid = LookupFuncName(stmt->plhandler, 0, typev);
if (!OidIsValid(procOid))
elog(ERROR, "function %s() doesn't exist",
NameListToString(stmt->plhandler));
if (get_func_rettype(procOid) != InvalidOid)
elog(ERROR, "function %s() does not return type \"opaque\"",
NameListToString(stmt->plhandler));
if (get_func_rettype(procOid) != LANGUAGE_HANDLEROID)
elog(ERROR, "function %s() does not return type %s",
NameListToString(stmt->plhandler),
format_type_be(LANGUAGE_HANDLEROID));
/* validate the validator function */
if (stmt->plvalidator)
@@ -91,6 +92,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
if (!OidIsValid(valProcOid))
elog(ERROR, "function %s(oid) doesn't exist",
NameListToString(stmt->plvalidator));
/* return value is ignored, so we don't check the type */
}
else
valProcOid = InvalidOid;

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.127 2002/08/18 11:20:05 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.128 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "commands/trigger.h"
#include "executor/executor.h"
#include "miscadmin.h"
@@ -222,9 +223,15 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
if (!HeapTupleIsValid(tuple))
elog(ERROR, "CreateTrigger: function %s() does not exist",
NameListToString(stmt->funcname));
if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != 0)
elog(ERROR, "CreateTrigger: function %s() must return OPAQUE",
NameListToString(stmt->funcname));
if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != TRIGGEROID)
{
/* OPAQUE is deprecated, but allowed for backwards compatibility */
if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype == OPAQUEOID)
elog(NOTICE, "CreateTrigger: OPAQUE is deprecated, use type TRIGGER instead to define trigger functions");
else
elog(ERROR, "CreateTrigger: function %s() must return TRIGGER",
NameListToString(stmt->funcname));
}
ReleaseSysCache(tuple);
/*

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.9 2002/08/15 16:36:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.10 2002/08/22 00:01:42 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -49,7 +49,7 @@
#include "utils/syscache.h"
static Oid findTypeIOFunction(List *procname, bool isOutput);
static Oid findTypeIOFunction(List *procname, Oid typeOid, bool isOutput);
/*
* DefineType
@@ -75,6 +75,7 @@ DefineType(List *names, List *parameters)
char *shadow_type;
List *pl;
Oid typoid;
Oid resulttype;
/* Convert list of names to a name and namespace */
typeNamespace = QualifiedNameGetCreationNamespace(names, &typeName);
@@ -116,7 +117,13 @@ DefineType(List *names, List *parameters)
delimiter = p[0];
}
else if (strcasecmp(defel->defname, "element") == 0)
{
elemType = typenameTypeId(defGetTypeName(defel));
/* disallow arrays of pseudotypes */
if (get_typtype(elemType) == 'p')
elog(ERROR, "Array element type cannot be %s",
format_type_be(elemType));
}
else if (strcasecmp(defel->defname, "default") == 0)
defaultValue = defGetString(defel);
else if (strcasecmp(defel->defname, "passedbyvalue") == 0)
@@ -179,9 +186,36 @@ DefineType(List *names, List *parameters)
if (outputName == NIL)
elog(ERROR, "Define: \"output\" unspecified");
/* Convert I/O proc names to OIDs */
inputOid = findTypeIOFunction(inputName, false);
outputOid = findTypeIOFunction(outputName, true);
/*
* Look to see if type already exists (presumably as a shell; if not,
* TypeCreate will complain). If it does then the declarations of the
* I/O functions might use it.
*/
typoid = GetSysCacheOid(TYPENAMENSP,
CStringGetDatum(typeName),
ObjectIdGetDatum(typeNamespace),
0, 0);
/*
* Convert I/O proc names to OIDs
*/
inputOid = findTypeIOFunction(inputName, typoid, false);
outputOid = findTypeIOFunction(outputName, typoid, true);
/*
* Verify that I/O procs return the expected thing. OPAQUE is an allowed
* (but deprecated) alternative to the fully type-safe choices.
*/
resulttype = get_func_rettype(inputOid);
if (!((OidIsValid(typoid) && resulttype == typoid) ||
resulttype == OPAQUEOID))
elog(ERROR, "Type input function %s must return %s or OPAQUE",
NameListToString(inputName), typeName);
resulttype = get_func_rettype(outputOid);
if (!(resulttype == CSTRINGOID ||
resulttype == OPAQUEOID))
elog(ERROR, "Type output function %s must return CSTRING or OPAQUE",
NameListToString(outputName));
/*
* now have TypeCreate do all the real work.
@@ -377,10 +411,9 @@ DefineDomain(CreateDomainStmt *stmt)
basetypeoid = HeapTupleGetOid(typeTup);
/*
* What we really don't want is domains of domains. This could cause all sorts
* of neat issues if we allow that.
*
* With testing, we may determine complex types should be allowed
* Base type must be a plain base type. Domains over pseudo types would
* create a security hole. Domains of domains might be made to work in
* the future, but not today. Ditto for domains over complex types.
*/
typtype = baseType->typtype;
if (typtype != 'b')
@@ -621,52 +654,109 @@ RemoveDomain(List *names, DropBehavior behavior)
/*
* Find a suitable I/O function for a type.
*
* typeOid is the type's OID, if it already exists as a shell type,
* otherwise InvalidOid.
*/
static Oid
findTypeIOFunction(List *procname, bool isOutput)
findTypeIOFunction(List *procname, Oid typeOid, bool isOutput)
{
Oid argList[FUNC_MAX_ARGS];
int nargs;
Oid procOid;
/*
* First look for a 1-argument func with all argtypes 0. This is
* valid for all kinds of procedure.
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
procOid = LookupFuncName(procname, 1, argList);
if (!OidIsValid(procOid))
if (isOutput)
{
/*
* Alternatively, input procedures may take 3 args (data
* value, element OID, atttypmod); the pg_proc argtype
* signature is 0,OIDOID,INT4OID. Output procedures may
* take 2 args (data value, element OID).
* Output functions can take a single argument of the type,
* or two arguments (data value, element OID). The signature
* may use OPAQUE in place of the actual type name; this is the
* only possibility if the type doesn't yet exist as a shell.
*/
if (isOutput)
if (OidIsValid(typeOid))
{
/* output proc */
nargs = 2;
argList[1] = OIDOID;
}
else
{
/* input proc */
nargs = 3;
argList[1] = OIDOID;
argList[2] = INT4OID;
}
procOid = LookupFuncName(procname, nargs, argList);
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
if (!OidIsValid(procOid))
func_error("TypeCreate", procname, 1, argList, NULL);
argList[0] = typeOid;
procOid = LookupFuncName(procname, 1, argList);
if (OidIsValid(procOid))
return procOid;
argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList);
if (OidIsValid(procOid))
return procOid;
}
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList);
if (OidIsValid(procOid))
return procOid;
argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList);
if (OidIsValid(procOid))
return procOid;
/* Prefer type name over OPAQUE in the failure message. */
if (OidIsValid(typeOid))
argList[0] = typeOid;
func_error("TypeCreate", procname, 1, argList, NULL);
}
else
{
/*
* Input functions can take a single argument of type CSTRING,
* or three arguments (string, element OID, typmod). The signature
* may use OPAQUE in place of CSTRING.
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = CSTRINGOID;
procOid = LookupFuncName(procname, 1, argList);
if (OidIsValid(procOid))
return procOid;
argList[1] = OIDOID;
argList[2] = INT4OID;
procOid = LookupFuncName(procname, 3, argList);
if (OidIsValid(procOid))
return procOid;
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList);
if (OidIsValid(procOid))
return procOid;
argList[1] = OIDOID;
argList[2] = INT4OID;
procOid = LookupFuncName(procname, 3, argList);
if (OidIsValid(procOid))
return procOid;
/* Use CSTRING (preferred) in the error message */
argList[0] = CSTRINGOID;
func_error("TypeCreate", procname, 1, argList, NULL);
}
return procOid;
return InvalidOid; /* keep compiler quiet */
}
/*-------------------------------------------------------------------
* DefineCompositeType
*

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.79 2002/07/20 05:29:01 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.80 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,6 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
Node *result;
if (targetTypeId == inputTypeId ||
targetTypeId == InvalidOid ||
node == NULL)
{
/* no conversion needed, but constraints may need to be applied */
@@ -97,6 +96,12 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
if (targetTypeId != baseTypeId)
result = (Node *) TypeConstraints(result, targetTypeId);
}
else if (targetTypeId == ANYOID ||
targetTypeId == ANYARRAYOID)
{
/* assume can_coerce_type verified that implicit coercion is okay */
result = node;
}
else if (IsBinaryCompatible(inputTypeId, targetTypeId))
{
/*
@@ -213,18 +218,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
if (inputTypeId == targetTypeId)
continue;
/*
* one of the known-good transparent conversions? then drop
* through...
*/
if (IsBinaryCompatible(inputTypeId, targetTypeId))
continue;
/* don't know what to do for the output type? then quit... */
if (targetTypeId == InvalidOid)
/* don't choke on references to no-longer-existing types */
if (!typeidIsValid(inputTypeId))
return false;
/* don't know what to do for the input type? then quit... */
if (inputTypeId == InvalidOid)
if (!typeidIsValid(targetTypeId))
return false;
/*
@@ -238,18 +235,44 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
continue;
}
/* accept if target is ANY */
if (targetTypeId == ANYOID)
continue;
/* if target is ANYARRAY and source is a varlena array type, accept */
if (targetTypeId == ANYARRAYOID)
{
Oid typOutput;
Oid typElem;
bool typIsVarlena;
if (getTypeOutputInfo(inputTypeId, &typOutput, &typElem,
&typIsVarlena))
{
if (OidIsValid(typElem) && typIsVarlena)
continue;
}
/*
* Otherwise reject; this assumes there are no explicit coercions
* to ANYARRAY. If we don't reject then parse_coerce would have
* to repeat the above test.
*/
return false;
}
/*
* one of the known-good transparent conversions? then drop
* through...
*/
if (IsBinaryCompatible(inputTypeId, targetTypeId))
continue;
/*
* If input is a class type that inherits from target, no problem
*/
if (typeInheritsFrom(inputTypeId, targetTypeId))
continue;
/* don't choke on references to no-longer-existing types */
if (!typeidIsValid(inputTypeId))
return false;
if (!typeidIsValid(targetTypeId))
return false;
/*
* Else, try for run-time conversion using functions: look for a
* single-argument function named with the target type name and

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.134 2002/08/08 01:44:30 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.135 2002/08/22 00:01:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1264,10 +1264,7 @@ func_error(const char *caller, List *funcname,
{
if (i)
appendStringInfo(&argbuf, ", ");
if (OidIsValid(argtypes[i]))
appendStringInfo(&argbuf, format_type_be(argtypes[i]));
else
appendStringInfo(&argbuf, "opaque");
appendStringInfo(&argbuf, format_type_be(argtypes[i]));
}
if (caller == NULL)
@@ -1289,7 +1286,7 @@ func_error(const char *caller, List *funcname,
* Convenience routine to check that a function exists and is an
* aggregate.
*
* Note: basetype is InvalidOid if we are looking for an aggregate on
* Note: basetype is ANYOID if we are looking for an aggregate on
* all types.
*/
Oid
@@ -1303,7 +1300,7 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
if (!OidIsValid(oid))
{
if (basetype == InvalidOid)
if (basetype == ANYOID)
elog(ERROR, "%s: aggregate %s(*) does not exist",
caller, NameListToString(aggname));
else
@@ -1322,7 +1319,7 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
if (!pform->proisagg)
{
if (basetype == InvalidOid)
if (basetype == ANYOID)
elog(ERROR, "%s: function %s(*) is not an aggregate",
caller, NameListToString(aggname));
else
@@ -1366,12 +1363,9 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes)
* Like LookupFuncName, but the argument types are specified by a
* list of TypeName nodes. Also, if we fail to find the function
* and caller is not NULL, then an error is reported via func_error.
*
* "opaque" is accepted as a typename only if opaqueOK is true.
*/
Oid
LookupFuncNameTypeNames(List *funcname, List *argtypes, bool opaqueOK,
const char *caller)
LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller)
{
Oid funcoid;
Oid argoids[FUNC_MAX_ARGS];
@@ -1389,15 +1383,10 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool opaqueOK,
TypeName *t = (TypeName *) lfirst(argtypes);
argoids[i] = LookupTypeName(t);
if (!OidIsValid(argoids[i]))
{
char *typnam = TypeNameToString(t);
if (opaqueOK && strcmp(typnam, "opaque") == 0)
argoids[i] = InvalidOid;
else
elog(ERROR, "Type \"%s\" does not exist", typnam);
}
if (!OidIsValid(argoids[i]))
elog(ERROR, "Type \"%s\" does not exist",
TypeNameToString(t));
argtypes = lnext(argtypes);
}

View File

@@ -1,7 +1,7 @@
#
# Makefile for utils/adt
#
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.52 2002/08/17 13:04:15 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.53 2002/08/22 00:01:43 tgl Exp $
#
subdir = src/backend/utils/adt
@@ -19,7 +19,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \
date.o datetime.o datum.o float.o format_type.o \
geo_ops.o geo_selfuncs.o int.o int8.o like.o lockfuncs.o \
misc.o nabstime.o name.o not_in.o numeric.o numutils.o \
oid.o oracle_compat.o \
oid.o oracle_compat.o pseudotypes.o \
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
tid.o timestamp.o varbit.o varchar.o varlena.o version.o \
network.o mac.o inet_net_ntop.o inet_net_pton.o \

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.51 2002/06/20 20:29:37 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.52 2002/08/22 00:01:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,59 +144,6 @@ int2vectoreq(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(int16)) == 0);
}
/*
* Type int44 has no real-world use, but the regression tests use it.
* It's a four-element vector of int4's.
*/
/*
* int44in - converts "num num ..." to internal form
*
* Note: Fills any missing positions with zeroes.
*/
Datum
int44in(PG_FUNCTION_ARGS)
{
char *input_string = PG_GETARG_CSTRING(0);
int32 *result = (int32 *) palloc(4 * sizeof(int32));
int i;
i = sscanf(input_string,
"%d, %d, %d, %d",
&result[0],
&result[1],
&result[2],
&result[3]);
while (i < 4)
result[i++] = 0;
PG_RETURN_POINTER(result);
}
/*
* int44out - converts internal form to "num num ..."
*/
Datum
int44out(PG_FUNCTION_ARGS)
{
int32 *an_array = (int32 *) PG_GETARG_POINTER(0);
char *result = (char *) palloc(16 * 4); /* Allow 14 digits +
* sign */
int i;
char *walk;
walk = result;
for (i = 0; i < 4; i++)
{
pg_ltoa(an_array[i], walk);
while (*++walk != '\0')
;
*walk++ = ' ';
}
*--walk = '\0';
PG_RETURN_CSTRING(result);
}
/*****************************************************************************
* PUBLIC ROUTINES *

View File

@@ -0,0 +1,234 @@
/*-------------------------------------------------------------------------
*
* pseudotypes.c
* Functions for the system pseudo-types.
*
* A pseudo-type isn't really a type and never has any operations, but
* we do need to supply input and output functions to satisfy the links
* in the pseudo-type's entry in pg_type. In most cases the functions
* just throw an error if invoked. (XXX the error messages here cover
* the most common case, but might be confusing in some contexts. Can
* we do better?)
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.1 2002/08/22 00:01:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "utils/builtins.h"
/*
* record_in - input routine for pseudo-type RECORD.
*/
Datum
record_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "RECORD");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* record_out - output routine for pseudo-type RECORD.
*/
Datum
record_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "RECORD");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* cstring_in - input routine for pseudo-type CSTRING.
*/
Datum
cstring_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "CSTRING");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* cstring_out - output routine for pseudo-type CSTRING.
*/
Datum
cstring_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "CSTRING");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* any_in - input routine for pseudo-type ANY.
*/
Datum
any_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "ANY");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* any_out - output routine for pseudo-type ANY.
*/
Datum
any_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "ANY");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* anyarray_in - input routine for pseudo-type ANYARRAY.
*/
Datum
anyarray_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "ANYARRAY");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* anyarray_out - output routine for pseudo-type ANYARRAY.
*/
Datum
anyarray_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "ANYARRAY");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* void_in - input routine for pseudo-type VOID.
*
* We allow this so that PL functions can return VOID without any special
* hack in the PL handler. Whatever value the PL thinks it's returning
* will just be ignored.
*/
Datum
void_in(PG_FUNCTION_ARGS)
{
PG_RETURN_VOID(); /* you were expecting something different? */
}
/*
* void_out - output routine for pseudo-type VOID.
*
* We allow this so that "SELECT function_returning_void(...)" works.
*/
Datum
void_out(PG_FUNCTION_ARGS)
{
PG_RETURN_CSTRING(pstrdup(""));
}
/*
* trigger_in - input routine for pseudo-type TRIGGER.
*/
Datum
trigger_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "TRIGGER");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* trigger_out - output routine for pseudo-type TRIGGER.
*/
Datum
trigger_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "TRIGGER");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* language_handler_in - input routine for pseudo-type LANGUAGE_HANDLER.
*/
Datum
language_handler_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "LANGUAGE_HANDLER");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* language_handler_out - output routine for pseudo-type LANGUAGE_HANDLER.
*/
Datum
language_handler_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "LANGUAGE_HANDLER");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* internal_in - input routine for pseudo-type INTERNAL.
*/
Datum
internal_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "INTERNAL");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* internal_out - output routine for pseudo-type INTERNAL.
*/
Datum
internal_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "INTERNAL");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* opaque_in - input routine for pseudo-type OPAQUE.
*/
Datum
opaque_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "OPAQUE");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* opaque_out - output routine for pseudo-type OPAQUE.
*/
Datum
opaque_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "OPAQUE");
PG_RETURN_VOID(); /* keep compiler quiet */
}

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.72 2002/07/29 22:14:11 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.73 2002/08/22 00:01:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@
#include "utils/syscache.h"
static void parseNameAndArgTypes(const char *string, const char *caller,
const char *type0_spelling,
bool allowNone,
List **names, int *nargs, Oid *argtypes);
@@ -260,7 +260,7 @@ regprocedurein(PG_FUNCTION_ARGS)
* datatype cannot be used for any system column that needs to receive
* data during bootstrap.
*/
parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", "opaque",
parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", false,
&names, &nargs, argtypes);
clist = FuncnameGetCandidates(names, nargs);
@@ -325,10 +325,7 @@ format_procedure(Oid procedure_oid)
if (i > 0)
appendStringInfoChar(&buf, ',');
if (OidIsValid(thisargtype))
appendStringInfo(&buf, "%s", format_type_be(thisargtype));
else
appendStringInfo(&buf, "opaque");
appendStringInfo(&buf, "%s", format_type_be(thisargtype));
}
appendStringInfoChar(&buf, ')');
@@ -584,7 +581,7 @@ regoperatorin(PG_FUNCTION_ARGS)
* datatype cannot be used for any system column that needs to receive
* data during bootstrap.
*/
parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", "none",
parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", true,
&names, &nargs, argtypes);
if (nargs == 1)
elog(ERROR, "regoperatorin: use NONE to denote the missing argument of a unary operator");
@@ -1036,12 +1033,12 @@ stringToQualifiedNameList(const char *string, const char *caller)
* the argtypes array should be of size FUNC_MAX_ARGS). The function or
* operator name is returned to *names as a List of Strings.
*
* If type0_spelling is not NULL, it is a name to be accepted as a
* placeholder for OID 0.
* If allowNone is TRUE, accept "NONE" and return it as InvalidOid (this is
* for unary operators).
*/
static void
parseNameAndArgTypes(const char *string, const char *caller,
const char *type0_spelling,
bool allowNone,
List **names, int *nargs, Oid *argtypes)
{
char *rawname;
@@ -1147,9 +1144,9 @@ parseNameAndArgTypes(const char *string, const char *caller,
*ptr2 = '\0';
}
if (type0_spelling && strcasecmp(typename, type0_spelling) == 0)
if (allowNone && strcasecmp(typename, "none") == 0)
{
/* Special case for OPAQUE or NONE */
/* Special case for NONE */
typeid = InvalidOid;
typmod = -1;
}

View File

@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.112 2002/06/20 20:29:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.113 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@
*
* This is represented at the SQL level (in pg_proc) as
*
* float8 oprrest (opaque, oid, opaque, int4);
* float8 oprrest (internal, oid, internal, int4);
*
* The call convention for a join estimator (oprjoin function) is similar
* except that varRelid is not needed:
@@ -62,7 +62,7 @@
* Oid operator,
* List *args);
*
* float8 oprjoin (opaque, oid, opaque);
* float8 oprjoin (internal, oid, internal);
*----------
*/

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.78 2002/08/05 02:30:50 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.79 2002/08/22 00:01:44 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1166,6 +1166,34 @@ get_typtype(Oid typid)
return '\0';
}
/*
* getTypeOutputInfo
*
* Get info needed for printing values of a type
*
* Returns true if data valid (a false result probably means it's a shell type)
*/
bool
getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
bool *typIsVarlena)
{
HeapTuple typeTuple;
Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID,
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "getTypeOutputInfo: Cache lookup of type %u failed", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
*typOutput = pt->typoutput;
*typElem = pt->typelem;
*typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
ReleaseSysCache(typeTuple);
return OidIsValid(*typOutput);
}
/* ---------- STATISTICS CACHE ---------- */

View File

@@ -4,7 +4,7 @@
# Makefile for utils/mb/conversion_procs
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.4 2002/08/14 02:45:10 ishii Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.5 2002/08/22 00:01:44 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -153,7 +153,7 @@ $(SQLSCRIPT): Makefile
func=$$1; shift; \
obj=$$1; shift; \
echo "-- $$se --> $$de"; \
echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, OPAQUE, OPAQUE, INTEGER) RETURNS INTEGER AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c';"; \
echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, CSTRING, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c';"; \
echo "DROP CONVERSION pg_catalog.$$name;"; \
echo "CREATE DEFAULT CONVERSION pg_catalog.$$name FOR '$$se' TO '$$de' FROM $$func;"; \
done > $@

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@ extern Datum mic_to_ascii(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,10 +63,10 @@ extern Datum alt_to_iso(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@ extern Datum mic_to_euc_cn(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,10 +47,10 @@ extern Datum mic_to_sjis(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@ extern Datum mic_to_euc_kr(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,10 +35,10 @@ extern Datum mic_to_big5(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,10 +35,10 @@ extern Datum win1250_to_latin2(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,10 +33,10 @@ extern Datum mic_to_latin4(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@ extern Datum utf8_to_ascii(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_big5(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,10 +39,10 @@ extern Datum alt_to_utf8(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_euc_cn(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_euc_jp(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_euc_kr(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_euc_tw(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_gb18030(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_gbk(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,10 +51,10 @@ extern Datum utf8_to_iso8859(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@ extern Datum utf8_to_iso8859_1(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.1 2002/07/16 09:25:06 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_johab(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.1 2002/07/16 09:25:06 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_sjis(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.1 2002/07/16 09:25:06 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_tcvn(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.1 2002/07/16 09:25:06 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum utf8_to_uhc(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/
Datum

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum win1250_to_utf(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum win1256_to_utf(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,10 @@ extern Datum win874_to_utf(PG_FUNCTION_ARGS);
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* OPAQUE, -- source string (null terminated C string)
* OPAQUE, -- destination string (null terminated C string)
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns INTEGER; -- dummy. returns nothing, actually.
* ) returns VOID;
* ----------
*/