Re: [SQL] feature request ?

2004-06-25 Thread Jaime Casanova
Hi all,   I ask: "why not to disallow nulls in boolean fields?". It was a question not a proposal. The explanation was clear to me. Nulls are not values but the absence of a known value.   It is comparable to the state of a c (or almost any other programming language) variable that had not been in

Re: [SQL] feature request ?

2004-06-25 Thread Richard Huxton
sad wrote: sad wrote: On Friday 25 June 2004 09:37, Rosser Schwarz wrote: On Fri, 25 Jun 2004 08:16:47 +0400, sad <[EMAIL PROTECTED]> wrote: Very simply, a boolean may have to values: true or false. It's also possible that it's not been set to anything (NULL). really ? what about (13 < NULL)::BO

Re: [SQL] feature request ?

2004-06-25 Thread Radu-Adrian Popescu
sad wrote: You can think of values in plpgsql as wrapper objects that carry a value and have a "is_null" flag; I have no idea how they're implemented in PostgreSQL or in any RDMBS in general but this should do it, at least for a naive implementation. Why should i think on simple object MUCH more c

Re: [SQL] feature request ?

2004-06-25 Thread sad
> sad wrote: > > On Friday 25 June 2004 09:37, Rosser Schwarz wrote: > >>On Fri, 25 Jun 2004 08:16:47 +0400, sad <[EMAIL PROTECTED]> wrote: > Very simply, a boolean may have to values: true or false. It's also > possible that it's not been set to anything (NULL). > >>> > >>>really ? > >>>w

Re: [SQL] feature request ?

2004-06-25 Thread Richard Huxton
sad wrote: On Friday 25 June 2004 09:37, Rosser Schwarz wrote: On Fri, 25 Jun 2004 08:16:47 +0400, sad <[EMAIL PROTECTED]> wrote: Very simply, a boolean may have to values: true or false. It's also possible that it's not been set to anything (NULL). really ? what about (13 < NULL)::BOOL Per the

Re: [SQL] feature request ?

2004-06-25 Thread sad
On Friday 25 June 2004 09:37, Rosser Schwarz wrote: > On Fri, 25 Jun 2004 08:16:47 +0400, sad <[EMAIL PROTECTED]> wrote: > > > Very simply, a boolean may have to values: true or false. It's also > > > possible that it's not been set to anything (NULL). > > > > really ? > > what about (13 < NULL)

Re: [SQL] feature request ?

2004-06-24 Thread Rosser Schwarz
On Fri, 25 Jun 2004 08:16:47 +0400, sad <[EMAIL PROTECTED]> wrote: > > Very simply, a boolean may have to values: true or false. It's also > > possible that it's not been set to anything (NULL). > really ? > what about (13 < NULL)::BOOL Per the semantics of NULL, 13 is neither greater than no

Re: [SQL] feature request ?

2004-06-24 Thread sad
> Very simply, a boolean may have to values: true or false. It's also > possible that it's not been set to anything (NULL). really ? what about (13 < NULL)::BOOL ---(end of broadcast)--- TIP 7: don't forget to increase your free space map sett

Re: [SQL] feature request ?

2004-06-24 Thread Geoffrey
Very simply, a boolean may have to values: true or false. It's also possible that it's not been set to anything (NULL). -- Until later, Geoffrey Registered Linux User #108567 Building secure systems in spite of Microsoft ---(end of broadcast)--

Re: [SQL] feature request ?

2004-06-24 Thread Andrew Sullivan
On Thu, Jun 24, 2004 at 12:32:59PM -0500, Jaime Casanova wrote: > > Why not disallow the ability of boolean fields to be null? Why not do it yourself? That's what the NOT NULL constraint is for. A -- Andrew Sullivan | [EMAIL PROTECTED] I remember when computers were frustrating because they

Re: [SQL] feature request ?

2004-06-24 Thread Stephan Szabo
On Thu, 24 Jun 2004, Bruno Wolff III wrote: > On Thu, Jun 24, 2004 at 07:34:18 -0700, > Stephan Szabo <[EMAIL PROTECTED]> wrote: > > > > I was thinking that something like Cs switch might work. There's still a > > question of the keywords because I don't like reusing case, but maybe > > somethi

Re: [SQL] feature request ?

2004-06-24 Thread Radu-Adrian Popescu
Bruno Wolff III wrote: There already is a syntax like this. You can do: CASE boolean_expression WHEN TRUE THEN whatever WHEN FALSE THEN whatever ELSE whatever END Besides, sad, there's no such thing as a tri-valued boolean. You either have a boolean(with a true/false value) or a NULL, which i

Re: [SQL] feature request ?

2004-06-24 Thread Bruno Wolff III
On Thu, Jun 24, 2004 at 07:34:18 -0700, Stephan Szabo <[EMAIL PROTECTED]> wrote: > > I was thinking that something like Cs switch might work. There's still a > question of the keywords because I don't like reusing case, but maybe > something of the general form: > case foo > is true > is fa

Re: [SQL] feature request ?

2004-06-24 Thread Jaime Casanova
Hi all,   Tri-valued boolean?? that's not against boolean concept?? i'm not saying that SQL is wrong nor Postgresql has to go beyond standard, i'm just trying to understand this stuff.   Why not disallow the ability of boolean fields to be null?   thanx in advance,   Jaime CasanovaMichael Glaesema

Re: [SQL] feature request ?

2004-06-24 Thread Michael Glaesemann
On Jun 24, 2004, at 6:39 PM, sad wrote: ...IF ELSEIF ELSE it's all clear but what about unequality of BOOL type possible value set and IF alternatives set In my opinion the short answer is NULL is here because of the SQL standard. The SQL standard does not specify any kind of "IF alternative" fo

Re: [SQL] feature request ?

2004-06-24 Thread Stephan Szabo
On Thu, 24 Jun 2004, sad wrote: > > then lots of currently perfectly correct > > programs break. If they're the same, then ELSE has different meanings > > depending on whether NULL is specified, and that's generally bad from an > > understanding the language standpoint. > > i've already thougth

Re: [SQL] feature request ?

2004-06-24 Thread sad
> then lots of currently perfectly correct > programs break. If they're the same, then ELSE has different meanings > depending on whether NULL is specified, and that's generally bad from an > understanding the language standpoint. i've already thougth on this new control structure needed but the

Re: [SQL] feature request ?

2004-06-24 Thread Stephan Szabo
On Thu, 24 Jun 2004, sad wrote: > > If you were to add a NULL block you'd have to deal with things > > like, if you only have a then and else, do you run the else on NULL or do > > you do nothing? If you do nothing, what if you want the null and else to > > be the same, do you add another way to

Re: [SQL] feature request ?

2004-06-24 Thread sad
> If you were to add a NULL block you'd have to deal with things > like, if you only have a then and else, do you run the else on NULL or do > you do nothing? If you do nothing, what if you want the null and else to > be the same, do you add another way to specify that? If you do the else, > the

Re: [SQL] feature request ?

2004-06-24 Thread Stephan Szabo
On Thu, 24 Jun 2004, sad wrote: > > I don't see what your point is. That SQL is wrong ? Or that SQL is not "C" > > ? Or that SQL is not a "programming language" ? > > Who said wrong ? who said SQL ? > > I thougth _WHY_ > the IF control structure has exactly two alternate blocks ? > a BOOLEAN expre

Re: [SQL] feature request ?

2004-06-24 Thread sad
On Thursday 24 June 2004 14:32, Alexander M. Pravking wrote: > On Thu, Jun 24, 2004 at 11:04:15AM +0400, sad wrote: > > Now you treat NULLs as false. > > Nope. NULL is neither true, nor false. It's "unknown", or "undefined". > > fduch=# SELECT 1 WHERE NULL::boolean; > ?column? > -- > (0 ro

Re: [SQL] feature request ?

2004-06-24 Thread Alexander M. Pravking
On Thu, Jun 24, 2004 at 11:04:15AM +0400, sad wrote: > Now you treat NULLs as false. Nope. NULL is neither true, nor false. It's "unknown", or "undefined". fduch=# SELECT 1 WHERE NULL::boolean; ?column? -- (0 rows) fduch=# SELECT 1 WHERE NOT NULL::boolean; ?column? -- (0 rows)

Re: [SQL] feature request ?

2004-06-24 Thread sad
...IF ELSEIF ELSE it's all clear but what about unequality of BOOL type possible value set and IF alternatives set ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] feature request ?

2004-06-24 Thread Iain
> > IF foo IS NULL > > THEN ... > > ELSIF foo > > THEN ... > > ELSE ... > > END IF; > > here the foo expression woll be executed twice if you can use an immutable or stable function then the overhead would be minimal as the system knows that it doesn't need to re-evaluate it. regards Iain

Re: [SQL] feature request ?

2004-06-24 Thread Michael Glaesemann
On Jun 24, 2004, at 1:49 PM, sad wrote: On Thursday 24 June 2004 09:32, Michael Glaesemann wrote: Creating a new control structure to do handle this seems odd. However, one could easily have the same effect using a nested if. Using the pl/pgsql ELSIF construct, it's pretty straightforward. IF foo I

Re: [SQL] feature request ?

2004-06-24 Thread sad
> I don't see what your point is. That SQL is wrong ? Or that SQL is not "C" > ? Or that SQL is not a "programming language" ? Who said wrong ? who said SQL ? I thougth _WHY_ the IF control structure has exactly two alternate blocks ? a BOOLEAN expression has exactly two possible values, that's

Re: [SQL] feature request ?

2004-06-24 Thread Gregory S. Williamson
rom: sad [mailto:[EMAIL PROTECTED] Sent: Wed 6/23/2004 10:01 PM To: [EMAIL PROTECTED] Cc: Subject:Re: [SQL] feature request ? On Wednesday 23 June 2004 21:12, you wrote: > Sad, > > > since BOOL expression has three possible values: TRUE,FALSE,NULL > > plpgsql IF

Re: [SQL] feature request ?

2004-06-23 Thread sad
On Wednesday 23 June 2004 21:12, you wrote: > Sad, > > > since BOOL expression has three possible values: TRUE,FALSE,NULL > > plpgsql IF control structure should have three alternate blocks: > > THEN,ELSE,NULL > > > > shouldn't it ? > > No, why? > > How would you construct a tri-valued IF/THEN?

Re: [SQL] feature request ?

2004-06-23 Thread sad
On Thursday 24 June 2004 09:32, Michael Glaesemann wrote: > On Jun 24, 2004, at 2:12 AM, Josh Berkus wrote: > > Sad, > > > >> since BOOL expression has three possible values: TRUE,FALSE,NULL > >> plpgsql IF control structure should have three alternate blocks: > >> THEN,ELSE,NULL > >> > >> shouldn'

Re: [SQL] feature request ?

2004-06-23 Thread Michael Glaesemann
On Jun 24, 2004, at 2:12 AM, Josh Berkus wrote: Sad, since BOOL expression has three possible values: TRUE,FALSE,NULL plpgsql IF control structure should have three alternate blocks: THEN,ELSE,NULL shouldn't it ? No, why? How would you construct a tri-valued IF/THEN? Doesn't seem too likely to

Re: [SQL] feature request ?

2004-06-23 Thread Josh Berkus
Sad, > since BOOL expression has three possible values: TRUE,FALSE,NULL > plpgsql IF control structure should have three alternate blocks: > THEN,ELSE,NULL > > shouldn't it ? No, why? How would you construct a tri-valued IF/THEN? Doesn't seem too likely to me, as well as being different fro

[SQL] feature request ?

2004-06-23 Thread sad
Hello since BOOL expression has three possible values: TRUE,FALSE,NULL plpgsql IF control structure should have three alternate blocks: THEN,ELSE,NULL shouldn't it ? ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ?

[SQL] feature request

2004-06-21 Thread sad
hello it might be stupid... sometimes i am starving UPDATE OR INSERT command thnx ---(end of broadcast)--- TIP 8: explain analyze is your friend