Best practice for naming temp table trigger functions - Mailing list pgsql-sql

From Sebastien Flaesch
Subject Best practice for naming temp table trigger functions
Date
Msg-id DBAP191MB128959B0FE1ABE28C04ACDFFB0089@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: Best practice for naming temp table trigger functions
List pgsql-sql
Hello!

Temporary tables can get triggers in PostgreSQL.

Triggers are defined with a trigger function.

A temp table name is local to the current SQL session so there is no conflict with concurrent code doing the same CREATE TEMP TABLE mytable ...

However, user functions called by triggers are global to the schema and can enter in conflict...

What is the best practice, to avoid such issues?

I guess I could use some session id to build a unique function name.

But I would like to have that function dropped when the temp table is destroyed ...

Or, is there a way to define triggers directly with some anonymous code block?

Seb

pgsql-sql by date:

Previous
From: Rob Sargent
Date:
Subject: Re: ERROR: extra data after last expected column
Next
From: scott macri
Date:
Subject: Re: ERROR: extra data after last expected column