Re: JDBC inserts on views using rules

From: "Jayesh K(dot) Parayali" <jparayali(at)TOTALFLOOD(dot)com>
To: "Barry Lind" <barry(at)xythos(dot)com>, "Stuart Robinson" <stuart(at)zapata(dot)org>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC inserts on views using rules
Date: 2001-11-09 19:55:33
Message-ID: 8ACB76BF6B98C94FB6959B660C051BA507D671@PACIFIC.TOTALFLOOD.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Did you try executeQuery in place of executeUpdate?
-Jayesh
> -----Original Message-----
> From: Barry Lind [SMTP:barry(at)xythos(dot)com]
> Sent: Friday, November 09, 2001 11:20 AM
> To: Stuart Robinson
> Cc: pgsql-jdbc(at)postgresql(dot)org
> Subject: Re: [JDBC] JDBC inserts on views using rules
>
> Stuart,
>
> What is the sql statement you are issuing that is causing this error.
> Without seeing the sql statement I am having a difficult time
> understanding exactly what you are trying to do.
>
> thanks,
> --Barry
>
>
> Stuart Robinson wrote:
>
> > I sent this to the general mailing list, but I thought it might be
> > appropriate for this forum, since it does relate to the JDBC.
> >
> > Regards,
> > Stuart Robinson
> >
> > ---------- Forwarded message ----------
> > Date: Thu, 8 Nov 2001 23:51:33 -0800 (PST)
> > From: Stuart Robinson <stuart(at)zapata(dot)org>
> > To: pgsql-general(at)postgresql(dot)org
> > Subject: [GENERAL] inserts on views using rules
> >
> > I've got a view that combines a couple of tables. The view is meant
> to
> > simplify interactions with a Java application, so that selects,
> inserts,
> > and updates can be made on the view as if it were a real table. So,
> I
> > figured that rules would be the way to go. For inserts, I wrote a
> > do-instead rule for the view which in turn calls a function. The
> function
> > is meant to take the values from the insert statement and stick them
> into
> > the appropriate tables. However, functions appear to always return a
> value
> > (except as triggers), which confuses the JDBC. So, when I do an
> insert on
> > the view, the function is called and returns a value, causing the
> > following error:
> >
> > A result was returned by the statement, when none was expected.
> > at
> org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:80)
> > at
> >
> org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement
> .java:122)
> >
> > I take it this is the expected JDBC behavior and not a bug. If so,
> what
> > are my options given that functions always return values and
> triggers
> > operate before or after inserts, but not instead of them? Is there
> some
> > way of calling functions so that they don't return a value? (If this
> > posting is more appropriate for another mailing list, please let me
> know.)
> > Thanks in advance.
> >
> > -Stuart Robinson
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
> >
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Browse pgsql-jdbc by date

  From Date Subject
Next Message Stuart Robinson 2001-11-09 21:54:57 Re: JDBC inserts on views using rules
Previous Message Dave Cramer 2001-11-09 19:21:07 Re: JDBC Connection