pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
What this parser mean?
3+ messages / 3 participants
[nested] [flat]

* What this parser mean?
@ 2003-03-21 02:47  Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 1 reply; 3+ messages in thread

From: Abdul Wahab Dahalan @ 2003-03-21 02:47 UTC (permalink / raw)
  To: pgsql-sql

I wrote a java program to query a data from 4 tables and the string
query is like:

querydata ="select
bizfavorite.bizid,bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,"

 + "bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY') as
listdate,bizfavorite.offerid,offer.otype,offer.bizid as obizid,"
 + "to_char(offer.oposted_date,'DD-MM-YYYY') as
oposted_date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as oexpiry_date,"
 + "userprofile.username,userprofile.ufullname,userprofile.uemail"
 + " from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid)"
 + " where bizfavorite.username= ? and urole='1' order by listdate desc"

 + " limit " + recordPerpage + "," + beginRecord;

When I run this query, I got this message : Message: ERROR:  parser:
parse error at or near "-"

but when I ran this query from psql command prompt its ok.I got what I
want.
b2bscm=> select
bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY')
as listdate,bizfavorite.offerid,offer.otype,offer.bizid as
obizid,to_char(offer.oposted_date,'DD-MM-YYYY') as
date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as
oexpiry_date,userprofile.username,userprofile.ufullname,userprofile.uemail
from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid) where bizfavorite.username=
'faiz' and urole='1' order by listdate desc limit 8,0;

Any help, very much appreciated..Thanks




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: What this parser mean?
@ 2003-03-21 02:52  David Witham <davidw@unidial.com.au>
  0 siblings, 0 replies; 3+ messages in thread

From: David Witham @ 2003-03-21 02:52 UTC (permalink / raw)
  To: wahab@mimos.my; pgsql-sql

Hi Abdul,

You may have lost the '' around the date specification in the to_char function when forming the string in Java. Before submitting the query, check the contents of the query string to make sure you still have the '' marks.

Regards,
David Witham

-----Original Message-----
From: Abdul Wahab Dahalan [mailto:wahab@mimos.my]
Sent: Friday, 21 March 2003 13:47
To: pgsql-sql@postgresql.org
Subject: [SQL] What this parser mean?


I wrote a java program to query a data from 4 tables and the string
query is like:

querydata ="select
bizfavorite.bizid,bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,"

 + "bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY') as
listdate,bizfavorite.offerid,offer.otype,offer.bizid as obizid,"
 + "to_char(offer.oposted_date,'DD-MM-YYYY') as
oposted_date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as oexpiry_date,"
 + "userprofile.username,userprofile.ufullname,userprofile.uemail"
 + " from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid)"
 + " where bizfavorite.username= ? and urole='1' order by listdate desc"

 + " limit " + recordPerpage + "," + beginRecord;

When I run this query, I got this message : Message: ERROR:  parser:
parse error at or near "-"

but when I ran this query from psql command prompt its ok.I got what I
want.
b2bscm=> select
bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY')
as listdate,bizfavorite.offerid,offer.otype,offer.bizid as
obizid,to_char(offer.oposted_date,'DD-MM-YYYY') as
date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as
oexpiry_date,userprofile.username,userprofile.ufullname,userprofile.uemail
from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid) where bizfavorite.username=
'faiz' and urole='1' order by listdate desc limit 8,0;

Any help, very much appreciated..Thanks


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: What this parser mean?
@ 2003-03-24 15:56  Guy Fraser <guy@incentre.net>
  parent: Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 0 replies; 3+ messages in thread

From: Guy Fraser @ 2003-03-24 15:56 UTC (permalink / raw)
  To: pgsql-sql

Hi

FYI

This line will not work in PostgreSQL 7.3 :

+ " limit " + recordPerpage + "," + beginRecord;

Change it to :

+ " limit " + recordPerpage + " offset " + beginRecord;

This works in pre PostgreSQL 7.3 versions as well.


Guy

Abdul Wahab Dahalan wrote:

>I wrote a java program to query a data from 4 tables and the string
>query is like:
>
>querydata ="select
>bizfavorite.bizid,bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,"
>
> + "bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY') as
>listdate,bizfavorite.offerid,offer.otype,offer.bizid as obizid,"
> + "to_char(offer.oposted_date,'DD-MM-YYYY') as
>oposted_date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as oexpiry_date,"
> + "userprofile.username,userprofile.ufullname,userprofile.uemail"
> + " from bizfavorite join bizprofile using(bizid) join userprofile
>using(bizid) left join offer using(offerid)"
> + " where bizfavorite.username= ? and urole='1' order by listdate desc"
>
> + " limit " + recordPerpage + "," + beginRecord;
>
>When I run this query, I got this message : Message: ERROR:  parser:
>parse error at or near "-"
>
>but when I ran this query from psql command prompt its ok.I got what I
>want.
>b2bscm=> select
>bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY')
>as listdate,bizfavorite.offerid,offer.otype,offer.bizid as
>obizid,to_char(offer.oposted_date,'DD-MM-YYYY') as
>date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as
>oexpiry_date,userprofile.username,userprofile.ufullname,userprofile.uemail
>from bizfavorite join bizprofile using(bizid) join userprofile
>using(bizid) left join offer using(offerid) where bizfavorite.username=
>'faiz' and urole='1' order by listdate desc limit 8,0;
>
>Any help, very much appreciated..Thanks
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>  
>




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-03-24 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 02:47 What this parser mean? Abdul Wahab Dahalan <wahab@mimos.my>
2003-03-24 15:56 ` Guy Fraser <guy@incentre.net>
2003-03-21 02:52 Re: What this parser mean? David Witham <davidw@unidial.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox