Re: [GENERAL] About functions

2000-02-24 Thread Peter Eisentraut

On 2000-02-23, Diego Schvartzman mentioned:

> Is it possible to return a row or a set of rows from a user defined funcion?
> Can I use user defined functions as "stored procedures"?

No. Several workarounds, such as using arrays or views are known, but none
really suffice.

-- 
Peter Eisentraut  Sernanders väg 10:115
[EMAIL PROTECTED]   75262 Uppsala
http://yi.org/peter-e/Sweden







Re: [GENERAL] Re: [General] pgsql on win95

2000-02-24 Thread Dustin Sallings

On Thu, 24 Feb 2000, root wrote:

# > I'm writing this email to you from a notebook. Running Linux. And Postgres.
# > :-) So, it's already being done (Notebooks aren't the issue here, I believe
# > it's an issue of OS choices).
# 
#  There're still some Windows'95 and Windows'98 users out there in the
# world ...

I'm not convinced that this is a reason to run a database server
on it.  I don't think anyone would complain if someone ported postgres to
Windows, but it seems like a silly exercise.  I've got a few macs around
the house, but I'm in no way interested in using them as data servers.

--
dustin sallingsThe world is watching America,
http://2852210114/~dustin/ and America is watching TV.






Re: [GENERAL] Re: [HACKERS] TRANSACTIONS

2000-02-24 Thread Lincoln Yeoh

At 02:16 PM 24-02-2000 -0500, Karl DeBisschop wrote:
>
>To summarize, I stated that the following does not work with
>postgresql:
>
>> $dbh->{AutoCommit} = 0;
>> $dbh->do("CREATE TABLE tmp (a int unique,b int)");
>> $rtv = $dbh->do("INSERT INTO tmp VALUES ($1,$2)");
>> if ($rtv) {$dbh->do("UPDATE tmp SET b=$2 where a=$1")};
>> $dbh->commit;
>> $dbh->disconnect;
>
>It's not that eval's error trapping is blown out - it's that the
>transaction defined by the AutoCommit cannot complete because a part
>of it cannot complete -- that's what atomicity means.

Maybe I don't understand the situation. But it doesn't seem to be a big
problem.

With postgres you have ensure that your application filters the data
properly before sticking it into the database. Then if the insert fails,
it's probably a serious database problem and in that case it's best that
the whole transaction is aborted anyway.

It indeed is a problem if the database engine is expected to parse the
data. For example - if you send in a date value, and the database engine
chokes on it. With the nonpostgresql behaviour you can still insert a NULL
instead for "Bad date/ Unknown date".

But from the security point of view it is best to reduce the amount of
parsing done by the database engine. Make sure the app sanitises and
massages everything so that the database has no problems with the data. It
can be a pain sometimes to figure out what the database can take (which is
why I've been asking for the limits for Postgresql fields and such- so the
app can keep everything within bounds or grumble to the user/vandal). Once
everything is set up nicely, if the database grumbles then the app screwed
up somehow (the vandal got through) and it's best to rollback everything
(we're lucky if the database just grumbled).

Cheerio,

Link.