127{
147 char *detailmsg;
150
151
152
153
155
161 "functions cannot have more than %d arguments",
164
165
166
168 {
169
170
171
172
173
175
181 elog(
ERROR,
"allParameterTypes is not a 1-D Oid array");
184
185 }
186 else
187 {
190 }
191
193 {
194
195
196
197
198
200
205 elog(
ERROR,
"parameterModes is not a 1-D char array");
207 }
208
209
210
211
212
216 if (detailmsg)
219 errmsg(
"cannot determine result data type"),
221
222
223
224
225
229 if (detailmsg)
232 errmsg(
"unsafe use of pseudo-type \"internal\""),
234
235
236
237
239 {
241 {
245 continue;
246
250 if (detailmsg)
253 errmsg(
"cannot determine result data type"),
258 if (detailmsg)
261 errmsg(
"unsafe use of pseudo-type \"internal\""),
263 }
264 }
265
266
268 {
269
270
271
272
273
275 {
277 {
281 elog(
ERROR,
"variadic parameter must be last");
282 break;
285 elog(
ERROR,
"variadic parameter must be last");
286 break;
288
289 break;
292 elog(
ERROR,
"variadic parameter must be last");
294 {
297 break;
300 break;
303 break;
304 default:
307 elog(
ERROR,
"variadic parameter is not an array");
308 break;
309 }
310 break;
311 default:
313 break;
314 }
315 }
316 }
317
318
319
320
321
323 {
327 }
328
351 else
355 else
359 else
363 else
367 else
372 else
376 else
380 else
382
383
386
387
392
394 {
395
398 bool isnull;
400
401 if (!replace)
404 errmsg(
"function \"%s\" already exists with same argument types",
409
410
411 if (
oldproc->prokind != prokind)
414 errmsg(
"cannot change routine kind"),
423 0)));
424
427 "DROP FUNCTION");
428
429
430
431
432
433
434
435
436
437 if (returnType !=
oldproc->prorettype ||
438 returnsSet !=
oldproc->proretset)
442 ?
errmsg(
"cannot change whether a procedure has output parameters")
443 :
errmsg(
"cannot change return type of existing function"),
444
445
446
447
448
452
453
454
455
456
458 {
461
468 ;
473 errmsg(
"cannot change return type of existing function"),
474 errdetail(
"Row type defined by OUT parameters is different."),
475
479 }
480
481
482
483
484
485
488 &isnull);
489 if (!isnull)
490 {
497
500 &isnull);
501 if (isnull)
503
511 {
513 continue;
518 errmsg(
"cannot change name of input parameter \"%s\"",
520
524 }
525 }
526
527
528
529
530
531
532
533
534
535 if (
oldproc->pronargdefaults != 0)
536 {
541
545 errmsg(
"cannot remove parameter defaults from existing function"),
546
550
555
556
560
562 {
565
569 errmsg(
"cannot change data type of existing parameter default value"),
570
575 }
576 }
577
578
579
580
581
585
586
589
592 }
593 else
594 {
595
597
598
603 else
605
612 }
613
614
616
617
618
619
620
621
622
625
627
629
630
633
634
637
638
641
642
644 {
647 }
648
649
651 {
654 }
655
656
658 {
661 }
662
663
666
667
670
671
672
673
674
675
676
677
678
681 (
errmsg(
"function \"%s\" will be effectively temporary",
685
686
687
688
689
690
691
692
693
695
697
698
701
702
706
707
709
711
712
714
716
717
719 {
721 int save_nestlevel = 0;
722
723
725
726
727
728
729
730
731
732
733
734
735
737 {
740 {
746 }
747 }
748
750
753 }
754
755
758
760}
void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, Oid ownerId, Acl *acl)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
Acl * get_user_default_acl(ObjectType objtype, Oid ownerId, Oid nsp_oid)
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define Assert(condition)
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
void record_object_address_dependencies(const ObjectAddress *depender, ObjectAddresses *referenced, DependencyType behavior)
void collectDependenciesOfExpr(ObjectAddresses *addrs, Node *expr, List *rtable)
bool find_temp_object(const ObjectAddresses *addrs, bool local_temp_okay, ObjectAddress *foundobj)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
void free_object_addresses(ObjectAddresses *addrs)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errdetail_internal(const char *fmt,...)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define OidFunctionCall1(functionId, arg1)
TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple)
TupleDesc build_function_result_tupdesc_d(char prokind, Datum proallargtypes, Datum proargmodes, Datum proargnames)
int get_func_input_arg_names(Datum proargnames, Datum proargmodes, char ***arg_names)
int NewGUCNestLevel(void)
void ProcessGUCArray(ArrayType *array, GucContext context, GucSource source, GucAction action)
void AtEOXact_GUC(bool isCommit, int nestLevel)
bool check_function_bodies
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Oid get_element_type(Oid typid)
void namestrcpy(Name name, const char *str)
bool isTempNamespace(Oid namespaceId)
Oid exprType(const Node *expr)
#define castNode(_type_, nodeptr)
#define InvokeObjectPostCreateHook(classId, objectId, subId)
char * getObjectDescription(const ObjectAddress *object, bool missing_ok)
#define ObjectAddressSet(addr, class_id, object_id)
char * nodeToString(const void *obj)
char * check_valid_internal_signature(Oid ret_type, const Oid *declared_arg_types, int nargs)
char * check_valid_polymorphic_signature(Oid ret_type, const Oid *declared_arg_types, int nargs)
long deleteDependencyRecordsFor(Oid classId, Oid objectId, bool skipExtensionDeps)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
static int list_length(const List *l)
static ListCell * list_nth_cell(const List *list, int n)
#define foreach_oid(var, lst)
static ListCell * lnext(const List *l, const ListCell *c)
FormData_pg_proc * Form_pg_proc
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
void pgstat_create_function(Oid proid)
static Datum PointerGetDatum(const void *X)
static Datum Float4GetDatum(float4 X)
static Datum UInt16GetDatum(uint16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
static Pointer DatumGetPointer(Datum X)
static Datum CharGetDatum(char X)
void * stringToNode(const char *str)
char * format_procedure(Oid procedure_oid)
#define RelationGetDescr(relation)
Oid values[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
bool equalRowTypes(TupleDesc tupdesc1, TupleDesc tupdesc2)
void CommandCounterIncrement(void)