7.2 behavior -- inserts, rules and jdbc

From: Richard Welty <rwelty(at)averillpark(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: 7.2 behavior -- inserts, rules and jdbc
Date: 2003-01-28 12:56:31
Message-ID: E18dVHz-000672-00@skipper.averillpark.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

first, the context: redhat 7.3, postgres 7.2.5, appropriate pgjdbc2.jar

i recently added a rule associated with a table insert. the rule calls a
stored pl/pgsql procedure to update another table in the database. i
couldn't find a way for the procedure to be called unless it returned a
value, so i declared it as returning int and return 1 every time.

the rule is as follows:

CREATE RULE OnPayment AS
ON INSERT TO payment
DO SELECT ApplyPayment ( new.customer_id,
new.against_credit_balance,
new.payment_type,
new.amount,
new.operator_id
);

so everything works now, _but_: if i use executeUpdate to issue my insert,
i get an SQL exception because a result is returned from ApplyPayment().
i ended up using executeQuery and ignoring the result set instead.

is this really the correct behavior, or have i missed something obvious?

thanks,
richard
--
Richard Welty rwelty(at)averillpark(dot)net
Averill Park Networking 518-573-7592
Unix, Linux, IP Network Engineering, Security

Browse pgsql-jdbc by date

  From Date Subject
Next Message Achilleus Mantzios 2003-01-28 12:58:24 7.3.1 UTF-8 bug(?) and 7.2.x Charset compatibility
Previous Message Achilleus Mantzios 2003-01-28 12:05:54 7.3.1 UTF-8 bug(?) and 7.2.x Charset compatibility