Re: how to make functions multi-user safe?

From: Christoph Dalitz <christoph(dot)dalitz(at)hs-niederrhein(dot)de>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to make functions multi-user safe?
Date: 2002-12-05 08:30:39
Message-ID: 20021205093039.48675e84.christoph.dalitz@hs-niederrhein.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Date: 04 Dec 2002 15:53:07 -0500
> From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message 帅猛 2002-12-05 08:31:02 install postgresql on cygwin error
Previous Message Oliver Elphick 2002-12-05 07:31:18 Debian pacakges of 7.3