pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Error with "limit" clause
3+ messages / 2 participants
[nested] [flat]

* Error with "limit" clause
@ 2006-06-13 23:19 Rommel the iCeMAn <icecrew@gmail.com>
  2006-06-14 01:58 ` Re: Error with "limit" clause Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Rommel the iCeMAn @ 2006-06-13 23:19 UTC (permalink / raw)
  To: pgsql-sql

Hi List,
 
I've been trying the following query from VB.NET: select * from my_table
order by column1 limit 1. This query works flawlessly when I use the
pgAdminIII query tool, but when I run this query from VB.NET, I get the
following error: syntax error at or near "limit". Any ideas as to the cause
of this error? Seems to me this error is specific to the PostgreSQL .NET
providers, what do you think?

If it's of any help, here's my connection string: database=test;User
ID=iceman;Password={suppressed};Server=my_server;Port=5432;Timeout=10

Thanks in advance,
Rommel Edwards.




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

* Re: Error with "limit" clause
  2006-06-13 23:19 Error with "limit" clause Rommel the iCeMAn <icecrew@gmail.com>
@ 2006-06-14 01:58 ` Tom Lane <tgl@sss.pgh.pa.us>
  2006-06-14 02:37   ` Re: Error with "limit" clause Rommel the iCeMAn <icecrew@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2006-06-14 01:58 UTC (permalink / raw)
  To: Rommel the iCeMAn <icecrew@gmail.com>; +Cc: pgsql-sql

"Rommel the iCeMAn" <icecrew@gmail.com> writes:
> I've been trying the following query from VB.NET: select * from my_table
> order by column1 limit 1. This query works flawlessly when I use the
> pgAdminIII query tool, but when I run this query from VB.NET, I get the
> following error: syntax error at or near "limit". Any ideas as to the cause
> of this error? Seems to me this error is specific to the PostgreSQL .NET
> providers, what do you think?

Could VB be rewriting the query behind your back?  Turn on log_statement
logging, and look in the postmaster log to see what's really being sent
to the backend ...

			regards, tom lane



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

* Re: Error with "limit" clause
  2006-06-13 23:19 Error with "limit" clause Rommel the iCeMAn <icecrew@gmail.com>
  2006-06-14 01:58 ` Re: Error with "limit" clause Tom Lane <tgl@sss.pgh.pa.us>
@ 2006-06-14 02:37   ` Rommel the iCeMAn <icecrew@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Rommel the iCeMAn @ 2006-06-14 02:37 UTC (permalink / raw)
  To: pgsql-sql

> Could VB be rewriting the query behind your back?  Turn on log_statement
logging, and look in the postmaster log to see what's really being sent to
the > backend ...

Exactly!

This was an oversight on my part tho. I had used the following command:

MyDataReader = MyCommand.ExecuteReader(CommandBehavior.SingleRow)

By passing the "CommandBehavior.SingleRow" parameter VB inserted the "limit
1" clause unknown to me. The solution was easy, either explicitly state
"limit 1" in my SQL query OR use the CommandBehavior.SingleRow parameter -
NOT BOTH :-)

Thanks for the input,
Rommel Edwards.




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


end of thread, other threads:[~2006-06-14 02:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-13 23:19 Error with "limit" clause Rommel the iCeMAn <icecrew@gmail.com>
2006-06-14 01:58 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-06-14 02:37   ` Rommel the iCeMAn <icecrew@gmail.com>

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