hello sql developers,
i have written function in which while executing it may throw error.
if the error thrown i want rollback the transaction if not i want commit.
how can i achive this task.
how can catch exception thrown in the function
plz help me
regards
konkodi
i have written function in which while executing it may throw error.
if the error thrown i want rollback the transaction if not i want commit.
BEGIN;
SELECT you_function(args);
...
many sql commands;
...
COMMIT;
that's all
if your function raises an error
whole transaction will be aborted
Hi,
i'm really new to postgres and have some doubts.
Hope somebody could explain.
Let say i have a table of clients and every client has a small number
of addresses. (let say 3)
My approch is to create a type address like this (simplified)
CREATE TYPE address AS
(
street
xchris wrote:
CREATE TYPE address AS
(
street VARCHAR(160),
cityINTEGER,
cap INTEGER,
country INTEGER (those are referring to other table)
);
and then composing table client
CREATE TABLE client
(
id
On gio, 2005-10-06 at 12:20 +0100, Richard Huxton wrote:
From the manuals...
I didn't search very well.Sorry!
However - I don't think you want to anyway. If you're going to use a
relational database, try a relational approach! Typically, you would do
something like [cut]
I wanted to
xchris wrote:
On gio, 2005-10-06 at 12:20 +0100, Richard Huxton wrote:
From the manuals...
I didn't search very well.Sorry!
Easy enough to miss.
However - I don't think you want to anyway. If you're going to use a
relational database, try a relational approach! Typically, you would do
You could continue with this function, with an
additional cursor to get the parameters for the function. If this is a one off
thing, that you just need to do once, you could use pg_dump to get the create
function statements and then simply alter them with an re in your favorite
editor.
Stewart Ben (RBAU/EQS4) * [EMAIL PROTECTED] writes:
Is there any easy way to script granting privileges to a number of
functions? I've got as far as the following code before realising that
I'll need to pass in the arguments, and the arguments are stored as OIDs
in pg_proc.
Is there any easy
On Oct 6, 2005, at 2:55 AM, padmanabha konkodi wrote:
i have written function in which while executing it may throw error.
if the error thrown i want rollback the transaction if not i want
commit.
how can i achive this task.
how can catch exception thrown in the function
The function
Dmitri Bichko [EMAIL PROTECTED] writes:
Ok, I'm thoroughly confused.
You didn't say which PG version you are using, but if it's something
reasonably recent then it should be able to push upper qual conditions
down into a UNION. I think you are getting bit by this restriction:
* 3. For
That's exactly it - thanks, works perfectly now!
For the record, it's 8.0.3
Dmitri
-Original Message-
From: Tom Lane [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 06, 2005 12:32 PM
To: Dmitri Bichko
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] UNION index use help
Greetings,
I have my DATESTYLE set to ISO MDY.
When I try to create a table with a default date of -00-00, psql says
that this is an invalid date. Why, and can (or how can I) get it to
accept -00-00 as a valid date?
Thanks,
-Josh
---(end of
On Thu, 6 Oct 2005 09:01:22 -0400 (EDT)
Joshua Kramer [EMAIL PROTECTED] wrote:
I have my DATESTYLE set to ISO MDY.
When I try to create a table with a default date of -00-00, psql says
that this is an invalid date. Why, and can (or how can I) get it to
accept -00-00 as a valid
On Thu, Oct 06, 2005 at 09:01:22AM -0400, Joshua Kramer wrote:
I have my DATESTYLE set to ISO MDY.
When I try to create a table with a default date of -00-00, psql says
that this is an invalid date. Why, and can (or how can I) get it to
accept -00-00 as a valid date?
You can't.
Hello, I'm trying to select records in a table not present in a related table, in example, I've a table with message information (subject, message, date, etc) and another (usermessages) with where user(s) has that message, its state, etc. Records in this table will be deleted in a certain time
Tom Lane [EMAIL PROTECTED] writes:
Richard Huxton dev@archonet.com writes:
Ah, now I see what you're saying. You're quite right in your suspicions,
MOVE... isn't supported for plpgsql cursors. You could probably do
something with EXECUTE and returning a refcursor from a previous
At 03:43 PM 10/6/05, Hector Rosas wrote:
Hello, I'm trying to select records in a table not present in a related
table, in example, I've a table with message information (subject,
message, date, etc) and another (usermessages) with where user(s) has that
message, its state, etc. Records in
On Thu, 2005-10-06 at 14:43, Hector Rosas wrote:
Hello, I'm trying to select records in a table not present in a
related table, in example, I've a table with message information
(subject, message, date, etc) and another (usermessages) with where
user(s) has that message, its state, etc.
Jeziel,
there are a couple techniques you can try, two I
like are set difference and anti-joins.
heres the set diff:
select id
from messages
except
select id
from usermessages
that will returns all id from messages not in usermessages
if ID is indexed on both
Folks,
I'm looking at using pg to be the main platform for integrating info
from other RDBMS products (particularly Oracle) as pg seems to be
the most flexible RDBMS around.
Disregarding writing to foreign products, query-plan efficiencies,
or differences of SQL dialect, I'd like to have a way
Dear All,
I use '$libdir/lo' for manage my PostgreSQL Large Object. It work fine for me to get and put Large Object from and to database. However I found something that may not correct when I try to backup my data. It seem that I cannot delete Large Object from database. It seem the thing I can
21 matches
Mail list logo