Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2E50163396C for ; Sun, 6 Jun 2010 19:12:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 26364-04 for ; Sun, 6 Jun 2010 22:12:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qmta13.emeryville.ca.mail.comcast.net (qmta13.emeryville.ca.mail.comcast.net [76.96.27.243]) by mail.postgresql.org (Postfix) with ESMTP id D17AB63236F for ; Sun, 6 Jun 2010 19:12:04 -0300 (ADT) Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta13.emeryville.ca.mail.comcast.net with comcast id Sl8a1e0051ZMdJ4ADmC3rf; Sun, 06 Jun 2010 22:12:03 +0000 Received: from sz0163.ev.mail.comcast.net ([76.96.26.231]) by omta16.emeryville.ca.mail.comcast.net with comcast id SmC21e0064zAJBQ8cmC26X; Sun, 06 Jun 2010 22:12:02 +0000 Date: Sun, 6 Jun 2010 22:12:02 +0000 (UTC) From: robert7390@comcast.net To: pgsql-jdbc@postgresql.org Message-ID: <159042738.834991275862322729.JavaMail.root@sz0163a.emeryville.ca.mail.comcast.net> Subject: connectivity issues with a plproxy function MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_45012_1250269919.1275862322728" X-Originating-IP: [72.5.59.161] X-Mailer: Zimbra 5.0.19_GA_3172.RHEL5_64 (ZimbraWebClient - FF3.0 (Linux)/5.0.19_GA_3177.RHEL5_64) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.509 tagged_above=-10 required=5 tests=BAYES_05=-0.5, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/45 X-Sequence-Number: 20615 ------=_Part_45012_1250269919.1275862322728 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi, I've got a JDBC client that's sending rapid fire inserts to a database. There's two methods I've used: a function call via plproxy and the plpgsql function call on the database in question. The proxy function is only inserting SOME values into the table. Otherwise,the operation works fine when the JDBC client is connecting directly to the function in the database, bypassing the proxy function. Here's the plroxy function call on the database "my_proxy"; CREATE OR REPLACE FUNCTION proxy_function.f_one ( bigint, varchar(255), int, out did_insert bool ) AS $$ cluster 'uds'; run on 0; $$ language plproxy strict security invoker; And here's the invoked function on the database "mydatabase". CREATE OR REPLACE FUNCTION proxy_function.f_one ( IN id_val bigint, IN name_val character varying(255), IN carrier_id_in integer, OUT did_insert boolean ) AS $$ BEGIN did_insert := false; if not exists(select id from mytable where id=id_val) then begin insert into mytable (id, name, carrier_id) values (id_val, name_val, carrier_id_in); did_insert := true; end; end if; END; $$ LANGUAGE PLPGSQL VOLATILE STRICT SECURITY DEFINER; I'd appreciate any insight. Thanks Robert ------=_Part_45012_1250269919.1275862322728 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Arial; font-size: 12pt; color: #000000'>Hi,
<= br>I've got a JDBC client that's sending rapid fire inserts to a database. = There's two methods I've used: a function call via plproxy and the plpgsql = function call on the database in question. The proxy function is only inser= ting SOME values into the table. Otherwise,the operation works fine when th= e JDBC client is connecting directly to the function in the database, bypas= sing the proxy function.

Here's the plroxy function call on the data= base "my_proxy";

CREATE OR REPLACE FUNCTION proxy_function.f_one (  bigint,
  varchar(255),
  int,
  out did_i= nsert bool
) AS
$$
  cluster 'uds';
  run on 0;
$$=
language plproxy
strict security invoker;


And here's the = invoked function on the database "mydatabase".

CREATE OR REPLACE FUN= CTION proxy_function.f_one (
    IN  id_val &nb= sp;            =     bigint,
    IN  name_val &nb= sp;            =   character varying(255),
    IN  carrier_id_in=            integer,
&n= bsp;   OUT did_insert       &n= bsp;      boolean
) AS
$$
BEGIN
 = did_insert :=3D false;
  if not exists(select id from mytable wher= e id=3Did_val) then
    begin
    =   insert into mytable (id, name, carrier_id) values (id_val, name_val,= carrier_id_in);
      did_insert :=3D true;    end;
  end if;
END;
$$
LANGUAGE PLPGSQ= L
VOLATILE
STRICT SECURITY DEFINER;


I'd appreciate any ins= ight.


Thanks

Robert

------=_Part_45012_1250269919.1275862322728--