return true / false instead of int4 value

Поиск
Список
Период
Сортировка
От Johnson, Shaunn
Тема return true / false instead of int4 value
Дата
Msg-id 73309C2FDD95D11192E60008C7B1D5BB04C73B59@snt452.corp.bcbsm.com
обсуждение исходный текст
Ответы Re: return true / false instead of int4 value  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: return true / false instead of int4 value  ("Peter Darley" <pdarley@kinesis-cem.com>)
Список pgsql-general

Howdy:
 
I want to know if this is even possible: How
can I return a true/false value instead of
integer?

I want to do something like this:
 
[snip]
 
select count(*) from t_table
having count(*) > 1500000
 
[/snip]

But want to return a true/false (bool) result.
 
Background:
 
The goal is to do what I have been doing for the
past few weeks - get a count of a table and,
based on the count, either create a new table
or fail and halt the rest of the related process.
 
I've done the function thing - it doesn't work
very well.  It stalls a few times and somehow
I created a bogus function type in one of the
system tables ... so ... I'm going to stay
away from that.
 
I've created a perl script to do exactly what
I want! ... 'cept ... during the regular
database refresh, it doesn't complete
until well AFTER I need it to ... other views
and tables are dependent on this one being
created first.
 
SO ... I'm looking for a nitch on how to
convert (and cast won't work for me) the
type from 'int4' to 'bool' for the above
sql excerpt.
 
*whew*
 
Suggestion?
 
HEY: Somebody send me some disco ... er ...
motivation music!
 
-X

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: ALTER TABLE
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: return true / false instead of int4 value