pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SELECT TOP X -- part 2 -- parse error?
6+ messages / 4 participants
[nested] [flat]

* SELECT TOP X -- part 2 -- parse error?
@ 1999-04-22 18:52  Justin Long <justinlong@strategicnetwork.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Justin Long @ 1999-04-22 18:52 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Thanks for the answers. I downloaded and installed PG5... now I have a new
problem. I can't seem to access any documentation on the syntax of the new
additions to PG5, and I'm getting a parse error with the following command

	SELECT * FROM database LIMIT 5

It says

	parse error at or near "5"

Also PSQL seems to still say 6.4.2 and have all the 6.4.2 functions
described in its help files. Is this indicative of a bad install? Everything
I saw appeared to indicate PG5 had installed properly and this parse error
leads me to think it is trying to interpret the LIMIT command but is having
problems with syntax.

Justin

-----Original Message-----
From: owner-pgsql-sql@postgreSQL.org
[mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of Justin Long
Sent: Thursday, April 22, 1999 10:33 AM
To: pgsql-sql@hub.org
Subject: [SQL] SELECT TOP _x_ ??


In Microsoft SQL Server you could issue a command

	SELECT TOP 5 * FROM database...


The top 5 indicator would mean to take the top 5 records that matched the
criteria. I can't seem to find any way to do this in PostgreSQL. I have a
database of 385 records (which will grow rapidly over the next few months)
and it takes better than 5 seconds to SELECT from the 385 and then use a
while loop to display the top 4. I can't imagine what it will be like when
we reach, say, 10,000 records! So any suggestions for selecting just the top
5 and speeding the process up a bit?

Any responses will be greatly appreciated. Respond here or to
JustinLong@strategicnetwork.org ...


Never retreat. Never surrender. Never cut a deal with a dragon.
_______________________________________________________________
Justin Long                   CIO / Site Editor
616 Station Square Ct         Network for Strategic Missions
Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
JustinLong@xc.org             Va Beach, VA 23463
Check out our site at:        http://www.strategicnetwork.org






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

* RE: [SQL] SELECT TOP X -- part 2 -- parse error?
@ 1999-04-22 21:12  Michael J Davis <michael.j.davis@tvguide.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael J Davis @ 1999-04-22 21:12 UTC (permalink / raw)
  To: 'justinlong@xc.org' <justinlong@xc.org>; pgsql-sql@hub.org

The LIMIT clause is new for version 6.5.  You will need to upgrade to take
advantage of "LIMIT".

	-----Original Message-----
	From:	Justin Long [SMTP:justinlong@strategicnetwork.org]
	Sent:	Thursday, April 22, 1999 12:53 PM
	To:	pgsql-sql@hub.org
	Subject:	[SQL] SELECT TOP X -- part 2 -- parse error?

	Thanks for the answers. I downloaded and installed PG5... now I have
a new
	problem. I can't seem to access any documentation on the syntax of
the new
	additions to PG5, and I'm getting a parse error with the following
command

		SELECT * FROM database LIMIT 5

	It says

		parse error at or near "5"

	Also PSQL seems to still say 6.4.2 and have all the 6.4.2 functions
	described in its help files. Is this indicative of a bad install?
Everything
	I saw appeared to indicate PG5 had installed properly and this parse
error
	leads me to think it is trying to interpret the LIMIT command but is
having
	problems with syntax.

	Justin

	-----Original Message-----
	From: owner-pgsql-sql@postgreSQL.org
	[mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of Justin Long
	Sent: Thursday, April 22, 1999 10:33 AM
	To: pgsql-sql@hub.org
	Subject: [SQL] SELECT TOP _x_ ??


	In Microsoft SQL Server you could issue a command

		SELECT TOP 5 * FROM database...


	The top 5 indicator would mean to take the top 5 records that
matched the
	criteria. I can't seem to find any way to do this in PostgreSQL. I
have a
	database of 385 records (which will grow rapidly over the next few
months)
	and it takes better than 5 seconds to SELECT from the 385 and then
use a
	while loop to display the top 4. I can't imagine what it will be
like when
	we reach, say, 10,000 records! So any suggestions for selecting just
the top
	5 and speeding the process up a bit?

	Any responses will be greatly appreciated. Respond here or to
	JustinLong@strategicnetwork.org ...


	Never retreat. Never surrender. Never cut a deal with a dragon.
	_______________________________________________________________
	Justin Long                   CIO / Site Editor
	616 Station Square Ct         Network for Strategic Missions
	Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
	JustinLong@xc.org             Va Beach, VA 23463
	Check out our site at:        http://www.strategicnetwork.org


	



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

* RE: [SQL] SELECT TOP X -- part 2 -- parse error?
@ 1999-04-22 21:23  Justin Long <justinlong@strategicnetwork.org>
  parent: Michael J Davis <michael.j.davis@tvguide.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Justin Long @ 1999-04-22 21:23 UTC (permalink / raw)
  To: pgsql-sql

I did upgrade to Postgresql 6.5... and as far as I can tell the install was
successful. As I noted it seems to be recognizing the LIMIT command... just
hitting a parse error at the '5' modifier.

Justin

> -----Original Message-----
> From: owner-pgsql-sql@postgreSQL.org
> [mailto:owner-pgsql-sql@postgreSQL.org]On Behalf Of Michael J Davis
> Sent: Thursday, April 22, 1999 5:13 PM
> To: 'justinlong@xc.org'; pgsql-sql@hub.org
> Subject: RE: [SQL] SELECT TOP X -- part 2 -- parse error?
>
>
> The LIMIT clause is new for version 6.5.  You will need to upgrade to take
> advantage of "LIMIT".
>
> 	-----Original Message-----
> 	From:	Justin Long [SMTP:justinlong@strategicnetwork.org]
> 	Sent:	Thursday, April 22, 1999 12:53 PM
> 	To:	pgsql-sql@hub.org
> 	Subject:	[SQL] SELECT TOP X -- part 2 -- parse error?
>
> 	Thanks for the answers. I downloaded and installed PG5... now I have
> a new
> 	problem. I can't seem to access any documentation on the syntax of
> the new
> 	additions to PG5, and I'm getting a parse error with the following
> command
>
> 		SELECT * FROM database LIMIT 5
>
> 	It says
>
> 		parse error at or near "5"
>
> 	Also PSQL seems to still say 6.4.2 and have all the 6.4.2 functions
> 	described in its help files. Is this indicative of a bad install?
> Everything
> 	I saw appeared to indicate PG5 had installed properly and this parse
> error
> 	leads me to think it is trying to interpret the LIMIT command but is
> having
> 	problems with syntax.
>
> 	Justin
>
> 	-----Original Message-----
> 	From: owner-pgsql-sql@postgreSQL.org
> 	[mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of Justin Long
> 	Sent: Thursday, April 22, 1999 10:33 AM
> 	To: pgsql-sql@hub.org
> 	Subject: [SQL] SELECT TOP _x_ ??
>
>
> 	In Microsoft SQL Server you could issue a command
>
> 		SELECT TOP 5 * FROM database...
>
>
> 	The top 5 indicator would mean to take the top 5 records that
> matched the
> 	criteria. I can't seem to find any way to do this in PostgreSQL. I
> have a
> 	database of 385 records (which will grow rapidly over the next few
> months)
> 	and it takes better than 5 seconds to SELECT from the 385 and then
> use a
> 	while loop to display the top 4. I can't imagine what it will be
> like when
> 	we reach, say, 10,000 records! So any suggestions for selecting just
> the top
> 	5 and speeding the process up a bit?
>
> 	Any responses will be greatly appreciated. Respond here or to
> 	JustinLong@strategicnetwork.org ...
>
>
> 	Never retreat. Never surrender. Never cut a deal with a dragon.
> 	_______________________________________________________________
> 	Justin Long                   CIO / Site Editor
> 	616 Station Square Ct         Network for Strategic Missions
> 	Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
> 	JustinLong@xc.org             Va Beach, VA 23463
> 	Check out our site at:        http://www.strategicnetwork.org
>
>
>
>
>




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

* RE: [SQL] SELECT TOP X -- part 2 -- parse error?
@ 1999-04-22 21:42  Michael J Davis <michael.j.davis@tvguide.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael J Davis @ 1999-04-22 21:42 UTC (permalink / raw)
  To: 'justinlong@xc.org' <justinlong@xc.org>; pgsql-sql

I have successfully used limit 5.  You might try:
	SELECT * FROM table_name LIMIT 5;
rather than:
	SELECT * FROM database LIMIT 5;

	-----Original Message-----
	From:	Justin Long [SMTP:justinlong@strategicnetwork.org]
	Sent:	Thursday, April 22, 1999 3:24 PM
	To:	pgsql-sql@postgreSQL.org
	Subject:	RE: [SQL] SELECT TOP X -- part 2 -- parse error?

	I did upgrade to Postgresql 6.5... and as far as I can tell the
install was
	successful. As I noted it seems to be recognizing the LIMIT
command... just
	hitting a parse error at the '5' modifier.

	Justin

	> -----Original Message-----
	> From: owner-pgsql-sql@postgreSQL.org
	> [mailto:owner-pgsql-sql@postgreSQL.org]On Behalf Of Michael J
Davis
	> Sent: Thursday, April 22, 1999 5:13 PM
	> To: 'justinlong@xc.org'; pgsql-sql@hub.org
	> Subject: RE: [SQL] SELECT TOP X -- part 2 -- parse error?
	>
	>
	> The LIMIT clause is new for version 6.5.  You will need to upgrade
to take
	> advantage of "LIMIT".
	>
	> 	-----Original Message-----
	> 	From:	Justin Long [SMTP:justinlong@strategicnetwork.org]
	> 	Sent:	Thursday, April 22, 1999 12:53 PM
	> 	To:	pgsql-sql@hub.org
	> 	Subject:	[SQL] SELECT TOP X -- part 2 -- parse error?
	>
	> 	Thanks for the answers. I downloaded and installed PG5...
now I have
	> a new
	> 	problem. I can't seem to access any documentation on the
syntax of
	> the new
	> 	additions to PG5, and I'm getting a parse error with the
following
	> command
	>
	> 		SELECT * FROM database LIMIT 5
	>
	> 	It says
	>
	> 		parse error at or near "5"
	>
	> 	Also PSQL seems to still say 6.4.2 and have all the 6.4.2
functions
	> 	described in its help files. Is this indicative of a bad
install?
	> Everything
	> 	I saw appeared to indicate PG5 had installed properly and
this parse
	> error
	> 	leads me to think it is trying to interpret the LIMIT
command but is
	> having
	> 	problems with syntax.
	>
	> 	Justin
	>
	> 	-----Original Message-----
	> 	From: owner-pgsql-sql@postgreSQL.org
	> 	[mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of Justin
Long
	> 	Sent: Thursday, April 22, 1999 10:33 AM
	> 	To: pgsql-sql@hub.org
	> 	Subject: [SQL] SELECT TOP _x_ ??
	>
	>
	> 	In Microsoft SQL Server you could issue a command
	>
	> 		SELECT TOP 5 * FROM database...
	>
	>
	> 	The top 5 indicator would mean to take the top 5 records
that
	> matched the
	> 	criteria. I can't seem to find any way to do this in
PostgreSQL. I
	> have a
	> 	database of 385 records (which will grow rapidly over the
next few
	> months)
	> 	and it takes better than 5 seconds to SELECT from the 385
and then
	> use a
	> 	while loop to display the top 4. I can't imagine what it
will be
	> like when
	> 	we reach, say, 10,000 records! So any suggestions for
selecting just
	> the top
	> 	5 and speeding the process up a bit?
	>
	> 	Any responses will be greatly appreciated. Respond here or
to
	> 	JustinLong@strategicnetwork.org ...
	>
	>
	> 	Never retreat. Never surrender. Never cut a deal with a
dragon.
	>
_______________________________________________________________
	> 	Justin Long                   CIO / Site Editor
	> 	616 Station Square Ct         Network for Strategic Missions
	> 	Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
	> 	JustinLong@xc.org             Va Beach, VA 23463
	> 	Check out our site at:
http://www.strategicnetwork.org
	>
	>
	>
	>
	>
	



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

* Re: [SQL] SELECT TOP X -- part 2 -- parse error?
@ 1999-04-23 00:18  Chris Bitmead <chris.bitmead@bigfoot.com>
  parent: Justin Long <justinlong@strategicnetwork.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Chris Bitmead @ 1999-04-23 00:18 UTC (permalink / raw)
  To: pgsql-sql


Are you familiar with how postgres is set up? Did you for example, make
sure your boot up process starts the new postmaster pointing to your new
postgres installation?

Justin Long wrote:
> 
> I did upgrade to Postgresql 6.5... and as far as I can tell the install was
> successful. As I noted it seems to be recognizing the LIMIT command... just
> hitting a parse error at the '5' modifier.
> 
> Justin
> 
> > -----Original Message-----
> > From: owner-pgsql-sql@postgreSQL.org
> > [mailto:owner-pgsql-sql@postgreSQL.org]On Behalf Of Michael J Davis
> > Sent: Thursday, April 22, 1999 5:13 PM
> > To: 'justinlong@xc.org'; pgsql-sql@hub.org
> > Subject: RE: [SQL] SELECT TOP X -- part 2 -- parse error?
> >
> >
> > The LIMIT clause is new for version 6.5.  You will need to upgrade to take
> > advantage of "LIMIT".
> >
> >       -----Original Message-----
> >       From:   Justin Long [SMTP:justinlong@strategicnetwork.org]
> >       Sent:   Thursday, April 22, 1999 12:53 PM
> >       To:     pgsql-sql@hub.org
> >       Subject:        [SQL] SELECT TOP X -- part 2 -- parse error?
> >
> >       Thanks for the answers. I downloaded and installed PG5... now I have
> > a new
> >       problem. I can't seem to access any documentation on the syntax of
> > the new
> >       additions to PG5, and I'm getting a parse error with the following
> > command
> >
> >               SELECT * FROM database LIMIT 5
> >
> >       It says
> >
> >               parse error at or near "5"
> >
> >       Also PSQL seems to still say 6.4.2 and have all the 6.4.2 functions
> >       described in its help files. Is this indicative of a bad install?
> > Everything
> >       I saw appeared to indicate PG5 had installed properly and this parse
> > error
> >       leads me to think it is trying to interpret the LIMIT command but is
> > having
> >       problems with syntax.
> >
> >       Justin
> >
> >       -----Original Message-----
> >       From: owner-pgsql-sql@postgreSQL.org
> >       [mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of Justin Long
> >       Sent: Thursday, April 22, 1999 10:33 AM
> >       To: pgsql-sql@hub.org
> >       Subject: [SQL] SELECT TOP _x_ ??
> >
> >
> >       In Microsoft SQL Server you could issue a command
> >
> >               SELECT TOP 5 * FROM database...
> >
> >
> >       The top 5 indicator would mean to take the top 5 records that
> > matched the
> >       criteria. I can't seem to find any way to do this in PostgreSQL. I
> > have a
> >       database of 385 records (which will grow rapidly over the next few
> > months)
> >       and it takes better than 5 seconds to SELECT from the 385 and then
> > use a
> >       while loop to display the top 4. I can't imagine what it will be
> > like when
> >       we reach, say, 10,000 records! So any suggestions for selecting just
> > the top
> >       5 and speeding the process up a bit?
> >
> >       Any responses will be greatly appreciated. Respond here or to
> >       JustinLong@strategicnetwork.org ...
> >
> >
> >       Never retreat. Never surrender. Never cut a deal with a dragon.
> >       _______________________________________________________________
> >       Justin Long                   CIO / Site Editor
> >       616 Station Square Ct         Network for Strategic Missions
> >       Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
> >       JustinLong@xc.org             Va Beach, VA 23463
> >       Check out our site at:        http://www.strategicnetwork.org
> >
> >
> >
> >
> >



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

* Re: [SQL] SELECT TOP X -- part 2 -- parse error?
@ 1999-04-23 14:25  José Soares <jose@sferacarta.com>
  parent: Justin Long <justinlong@strategicnetwork.org>
  0 siblings, 0 replies; 6+ messages in thread

From: José Soares @ 1999-04-23 14:25 UTC (permalink / raw)
  To: justinlong@xc.org; +Cc: pgsql-sql@hub.org



Justin Long ha scritto:

> Thanks for the answers. I downloaded and installed PG5... now I have a new
> problem. I can't seem to access any documentation on the syntax of the new
> additions to PG5, and I'm getting a parse error with the following command
>
>         SELECT * FROM database LIMIT 5

                                         ^^^^^^^^
database ????
the right syntax is:
    SELECT * FROM table LIMIT 5

>
> It says
>
>         parse error at or near "5"
>

EXAMPLE:

prova=> select * from test limit 1;
  v|  c|  i
---+---+---
123|123|123
(1 row)

José




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


end of thread, other threads:[~1999-04-23 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-22 18:52 SELECT TOP X -- part 2 -- parse error? Justin Long <justinlong@strategicnetwork.org>
1999-04-23 14:25 ` José Soares <jose@sferacarta.com>
1999-04-22 21:12 RE: [SQL] SELECT TOP X -- part 2 -- parse error? Michael J Davis <michael.j.davis@tvguide.com>
1999-04-22 21:23 ` Justin Long <justinlong@strategicnetwork.org>
1999-04-23 00:18   ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-04-22 21:42 RE: [SQL] SELECT TOP X -- part 2 -- parse error? Michael J Davis <michael.j.davis@tvguide.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