Re: [GENERAL] Question on confusing behavior

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Wolfe <steve(at)iboats(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Question on confusing behavior
Date: 1999-09-23 21:07:50
Message-ID: 199909232107.RAA25552@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Today, I told someone the syntax for "count" without thinking, and
> got it wrong - and in so doing, I found some interesting behavior.
>
>
> select count('table.fieldname');
>
> works. however...
>
> select count('table.fieldname') where table.fieldname='something';

Using the table.field in single-quotes makes it a string, and that is a
strange query.

Legally, you can do:

select count(*) where table.fieldname='something';
select count(table.fieldname) where table.fieldname='something';

However, I see your point, and will add it to the TODO list:

* SELECT COUNT('asdf') FROM pg_class WHERE oid=12 crashes

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Kelly 1999-09-23 23:55:18 pl/pgsql
Previous Message Hannu Krosing 1999-09-23 21:04:59 Re: [HACKERS] Re: [GENERAL] Update of bitmask type