pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Boolean test
4+ messages / 3 participants
[nested] [flat]

* Boolean test
@ 2002-03-15 04:32  Rudi Starcevic <rudi@oasis.net.au>
  0 siblings, 2 replies; 4+ messages in thread

From: Rudi Starcevic @ 2002-03-15 04:32 UTC (permalink / raw)
  To: pgsql-sql

    Hi,

I can't see why my sql here is throwing an error,
    SELECT    *
    FROM    plan_template
    WHERE    public = true;

The field public is 'boolean'

I've also tried :
    WHERE    public = 'true';
    WHERE    public = t;
    WHERE    public = 't';
    WHERE    public = 'Yes';

Can you offer some advice ?
Thanks
Rudi.




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

* Re: Boolean test
@ 2002-03-15 04:58  Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  parent: Rudi Starcevic <rudi@oasis.net.au>
  1 sibling, 0 replies; 4+ messages in thread

From: Christopher Kings-Lynne @ 2002-03-15 04:58 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; pgsql-sql

> I can't see why my sql here is throwing an error,
>     SELECT    *
>     FROM    plan_template
>     WHERE    public = true;
>
> The field public is 'boolean'

That should work perfectly...

> I've also tried :
>     WHERE    public = 'true';
	^^^ Won't work (I think)
>     WHERE    public = t;
	^^^ Won't work (I think)
>     WHERE    public = 't';
	^^^ Will work
>     WHERE    public = 'Yes';
	^^^ Won't work (I think)

However, the cleanest way to do it is like this:

SELECT *
FROM plan_template
WHERE public;

Since none of the above are working for you, I think there's something wrong
with your schema...

Chris





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

* Re: Boolean test
@ 2002-03-15 05:10  Peter Eisentraut <peter_e@gmx.net>
  parent: Rudi Starcevic <rudi@oasis.net.au>
  1 sibling, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2002-03-15 05:10 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; +Cc: pgsql-sql

Rudi Starcevic writes:

> I can't see why my sql here is throwing an error,

(Next time it might be nice to show *what* error...)

>     SELECT    *
>     FROM    plan_template
>     WHERE    public = true;

"public" is a reserved word.  You need to double-quote it to be able to
use it.

-- 
Peter Eisentraut   peter_e@gmx.net




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

* Re: Boolean test
@ 2002-03-18 00:53  Rudi Starcevic <rudi@oasis.net.au>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Rudi Starcevic @ 2002-03-18 00:53 UTC (permalink / raw)
  To: pgsql-sql

Hi,

Thanks for your replies.
Peter was spot on.
I was trying to use a reserved word 'public'
'public_plan' works fine.

Kind regards
Rudi Starcevic.


Peter Eisentraut wrote:

>Rudi Starcevic writes:
>
>>I can't see why my sql here is throwing an error,
>>
>
>(Next time it might be nice to show *what* error...)
>
>>    SELECT    *
>>    FROM    plan_template
>>    WHERE    public = true;
>>
>
>"public" is a reserved word.  You need to double-quote it to be able to
>use it.
>






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


end of thread, other threads:[~2002-03-18 00:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-03-15 04:32 Boolean test Rudi Starcevic <rudi@oasis.net.au>
2002-03-15 04:58 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-03-15 05:10 ` Peter Eisentraut <peter_e@gmx.net>
2002-03-18 00:53   ` Rudi Starcevic <rudi@oasis.net.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