pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
error with mor than 1 sub-select
5+ messages / 4 participants
[nested] [flat]

* error with mor than 1 sub-select
@ 2006-08-23 01:47 chrisj <chrisj.wood@sympatico.ca>
  2006-08-23 02:03 ` Re: error with mor than 1 sub-select Osvaldo Kussama <osvaldo_kussama@yahoo.com.br>
  2006-08-23 02:06 ` Re: error with mor than 1 sub-select Michael Fuhr <mike@fuhr.org>
  0 siblings, 2 replies; 5+ messages in thread

From: chrisj @ 2006-08-23 01:47 UTC (permalink / raw)
  To: pgsql-sql


Hi,

I am fairly new to PostgreSQL but not to SQL.  Is this a bug or a
limitation...

The first query works fine, but when a second sub-query is added I get a
syntax error...

psql protocal2 -U p2user << EOF1
    select *
       from serv_res SR
       where serv_key = 10
         and not exists 
            (select 1
              from reservation R
            )
--         and not exits 
--            (select 1 
--               from interval R1
--            )
order by 1
;
    select *
       from serv_res SR
       where serv_key = 10
         and not exists 
            (select 1
               from reservation R
            )
         and not exits
            (select 1
               from interval R1
            )
order by 1
;

EOF1

The output is as follows:

Password for user p2user:
 serv_key | res_key | start_off_min | duration_min
----------+---------+---------------+--------------
(0 rows)

ERROR:  syntax error at or near "select" at character 192
LINE 9:             (select 1
                     ^

Note:  This is not the actual query I want to run but just kept removing
complexity until the problem (multiple sub-selects) seemed obvious.
-- 
View this message in context: http://www.nabble.com/error-with-mor-than-1-sub-select-tf2149934.html#a5936948
Sent from the PostgreSQL - sql forum at Nabble.com.




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

* Re: error with mor than 1 sub-select
  2006-08-23 01:47 error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
@ 2006-08-23 02:03 ` Osvaldo Kussama <osvaldo_kussama@yahoo.com.br>
  1 sibling, 0 replies; 5+ messages in thread

From: Osvaldo Kussama @ 2006-08-23 02:03 UTC (permalink / raw)
  To: chrisj <chrisj.wood@sympatico.ca>; pgsql-sql



chrisj <chrisj.wood@sympatico.ca> escreveu: 
Hi,

I am fairly new to PostgreSQL but not to SQL.  Is this a bug or a
limitation...

The first query works fine, but when a second sub-query is added I get a
syntax error...

psql protocal2 -U p2user << EOF1
    select *
       from serv_res SR
       where serv_key = 10
         and not exists 
            (select 1
              from reservation R
            )
--         and not exits 
--            (select 1 
--               from interval R1
--            )
order by 1
;
    select *
       from serv_res SR
       where serv_key = 10
         and not exists 
            (select 1
               from reservation R
            )
         and not exits

exi*S*ts

            (select 1
               from interval R1
            )
order by 1
;

EOF1

The output is as follows:

Password for user p2user:
 serv_key | res_key | start_off_min | duration_min
----------+---------+---------------+--------------
(0 rows)

ERROR:  syntax error at or near "select" at character 192
LINE 9:             (select 1
                     ^

Note:  This is not the actual query I want to run but just kept removing
complexity until the problem (multiple sub-selects) seemed obvious.
-- 
View this message in context: http://www.nabble.com/error-with-mor-than-1-sub-select-tf2149934.html#a5936948
Sent from the PostgreSQL - sql forum at Nabble.com.




[]s
Osvaldo


 		
---------------------------------
 Yahoo! Search
 Música para ver e ouvir: You're Beautiful, do James Blunt

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

* Re: error with mor than 1 sub-select
  2006-08-23 01:47 error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
@ 2006-08-23 02:06 ` Michael Fuhr <mike@fuhr.org>
  2006-08-23 02:26   ` Re: error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
  1 sibling, 1 reply; 5+ messages in thread

From: Michael Fuhr @ 2006-08-23 02:06 UTC (permalink / raw)
  To: chrisj <chrisj.wood@sympatico.ca>; +Cc: pgsql-sql

On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote:
> The first query works fine, but when a second sub-query is added I get a
> syntax error...
> 
> psql protocal2 -U p2user << EOF1
>     select *
>        from serv_res SR
>        where serv_key = 10
>          and not exists 
>             (select 1
>               from reservation R
>             )
> --         and not exits 

Does the real query have "exits" instead of "exists"?  I created
some test tables and fixed that typo and then both queries worked.

-- 
Michael Fuhr



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

* Re: error with mor than 1 sub-select
  2006-08-23 01:47 error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
  2006-08-23 02:06 ` Re: error with mor than 1 sub-select Michael Fuhr <mike@fuhr.org>
@ 2006-08-23 02:26   ` chrisj <chrisj.wood@sympatico.ca>
  2006-08-23 14:57     ` Re: error with mor than 1 sub-select Erik Jones <erik@myemma.com>
  0 siblings, 1 reply; 5+ messages in thread

From: chrisj @ 2006-08-23 02:26 UTC (permalink / raw)
  To: pgsql-sql


thanks, stupid user error.

i guess the pointer on the error message led me astray


Michael Fuhr wrote:
> 
> On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote:
>> The first query works fine, but when a second sub-query is added I get a
>> syntax error...
>> 
>> psql protocal2 -U p2user << EOF1
>>     select *
>>        from serv_res SR
>>        where serv_key = 10
>>          and not exists 
>>             (select 1
>>               from reservation R
>>             )
>> --         and not exits 
> 
> Does the real query have "exits" instead of "exists"?  I created
> some test tables and fixed that typo and then both queries worked.
> 
> -- 
> Michael Fuhr
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 
> 

-- 
View this message in context: http://www.nabble.com/error-with-more-than-1-sub-select-tf2149934.html#a5937248
Sent from the PostgreSQL - sql forum at Nabble.com.




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

* Re: error with mor than 1 sub-select
  2006-08-23 01:47 error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
  2006-08-23 02:06 ` Re: error with mor than 1 sub-select Michael Fuhr <mike@fuhr.org>
  2006-08-23 02:26   ` Re: error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
@ 2006-08-23 14:57     ` Erik Jones <erik@myemma.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Erik Jones @ 2006-08-23 14:57 UTC (permalink / raw)
  To: chrisj <chrisj.wood@sympatico.ca>; +Cc: pgsql-sql

Actually, it pointed you right to it.  Notice that exits is just before 
where the pointer was.

chrisj wrote:
> thanks, stupid user error.
>
> i guess the pointer on the error message led me astray
>
>
> Michael Fuhr wrote:
>   
>> On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote:
>>     
>>> The first query works fine, but when a second sub-query is added I get a
>>> syntax error...
>>>
>>> psql protocal2 -U p2user << EOF1
>>>     select *
>>>        from serv_res SR
>>>        where serv_key = 10
>>>          and not exists 
>>>             (select 1
>>>               from reservation R
>>>             )
>>> --         and not exits 
>>>       
>> Does the real query have "exits" instead of "exists"?  I created
>> some test tables and fixed that typo and then both queries worked.
>>
>> -- 
>> Michael Fuhr
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>>                http://archives.postgresql.org
>>
>>
>>     
>
>   


-- 
erik jones <erik@myemma.com>
software development
emma(r)




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


end of thread, other threads:[~2006-08-23 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-23 01:47 error with mor than 1 sub-select chrisj <chrisj.wood@sympatico.ca>
2006-08-23 02:03 ` Osvaldo Kussama <osvaldo_kussama@yahoo.com.br>
2006-08-23 02:06 ` Michael Fuhr <mike@fuhr.org>
2006-08-23 02:26   ` chrisj <chrisj.wood@sympatico.ca>
2006-08-23 14:57     ` Erik Jones <erik@myemma.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