mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +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:
@ -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);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user