Re: how to make functions multi-user safe? - Mailing list pgsql-general

From Christoph Dalitz
Subject Re: how to make functions multi-user safe?
Date
Msg-id 20021205093039.48675e84.christoph.dalitz@hs-niederrhein.de
Whole thread Raw
In response to how to make functions multi-user safe?  (Robert Treat <xzilla@users.sourceforge.net>)
List pgsql-general
> Date: 04 Dec 2002 15:53:07 -0500
> From: Robert Treat <xzilla@users.sourceforge.net>
>
> Our goal: To have a multiuser-safe function that checks for the existence of a table.  If the table
> exists, it should return the name of the table.  If it does not exist, it will call another
> function that creates the table and then it should return the name of the table after it's been created.
>
The most basic rule in database design is that applications must not change the
database schema but only the database contents. According to this rule a function
that changes the schema and is called by several application users parallel is a
bad idea.

It is generally a wrong assumption that DDL statements can be run "multi user safe"
at all: eg. in Oracle DDL statements are not run in transactions (sorry, no rollback
for a "drop table") and are not allowed in stored procedures.

So what is the reasoning behind your odd function?
It is most probably a design flaw.

Christoph Dalitz

pgsql-general by date:

Previous
From: "帅猛"
Date:
Subject: install postgresql on cygwin error
Next
From: Hiroshi Inoue
Date:
Subject: Re: passwords in pg_shadow (duplicate).