Re: FW: [SQL] "=" operator vs. "IS"

2004-06-29 Thread Michael Kleiser
NULL is handled like "unknow"
When you comparing something with an unknown value,
you are not able to say if they are equal or not.
So the result is also unknown.
The result NULL is correct.
If you whant to check if somethings is NULL
you have to use "(anything) IS NULL"

Rich Hall schrieb:
My question is why is the form
"(anything) = NULL"
allowed?
Since
"(anything) = NULL" is always Null, this cannot be what the coder
intended. 

This is much different when comparing two variables, where the coder may
have to handle the cases where the variables are Null. Here the
comparison is to a constant.

Rick

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
   http://www.postgresql.org/docs/faqs/FAQ.html

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] quoting

2004-07-02 Thread Michael Kleiser
I could not found an other quoting.
This quoting us annoying me also. 
I would be nice to have an additional simpler quoting 
in one of the next versions.

-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Mittwoch, 30. Juni 2004 07:12
To: [EMAIL PROTECTED]
Topic: [SQL] quoting


I'm not a pgsql user, but reading chapter 37 of the user docs -
plpgsql-statements.html, I see that PL/pgsql requires quotes around FUNCTION
and PROCEDURE text, and I just want to comment that that seems like a rather
unfortunate decision. I like MS SQL's batch separation with GO better, but
lacking that, might there be an optional different quoting syntax, perhaps
like the HEREDOC syntax of bash or Perl, or like Perl's q() or qq() quoting
operators (or q{}, q[], etc)?

At least new users would be able to write their pl/pgsql commands in syntax
that doesn't require 2, 4, 8, or more single quote characters to represent
one.



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] MySQL-style "create temporary table foo select ..."

2004-07-21 Thread Michael Kleiser
create temporary table tmp_foo AS select * from foo;
Geoff Richards schrieb:
Hi,
I've got some code that currently uses MySQL, and it copies an existing
table into a temporary one like so:
   create temporary table tmp_foo select * from foo;
That creates 'tmp_foo' with the same columns as 'foo', which is
very convenient.  I can't seem to find any reference to how to do
that with Postgres (and I'd like if possible to ditch MySQL).
Just wondering if anyone has ideas about how to do this?  I'd like
to avoid having to work up a table definition to define the temp
table's columns.
Or maybe I could do some sort of trick with the system catalog tables
to get the column information in a convenient form?
   cheers,
  geoff

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] Displaying two tables side by side

2004-08-11 Thread Michael Kleiser
select
  ( select a from t1 where CAST(t1.oid AS int) - CAST( (select min(oid) from t1) AS 
int ) = t_all.rownum ) AS a
, ( select b from t1 where CAST(t1.oid AS int) - CAST( (select min(oid) from t1) AS 
int ) = t_all.rownum ) AS a
, ( select c from t2 where CAST(t2.oid AS int) - CAST( (select min(oid) from t2) AS 
int ) = t_all.rownum ) AS a
, ( select d from t2 where CAST(t2.oid AS int) - CAST( (select min(oid) from t2) AS 
int ) = t_all.rownum ) AS a
from (
  select cast(t1.oid AS int) - CAST( (select min(oid) from t1) AS int ) AS rownum
UNION
  select cast(t2.oid AS int) - CAST( (select min(oid) from t2) AS int ) AS rownum
) AS t_all;
 a | a | a | a
---+---+---+---
 2 | 2 | 4 | 5
 3 | 5 | 7 | 3
 4 | 7 | 3 | 2
 9 | 0 | 1 | 1
   |   | 2 | 0
David Garamond schrieb:
How can you display two tables side by side? Example:
 > select * from t1;
 a | b
---+---
 2 | 2
 3 | 5
 4 | 7
 9 | 0
 > select * from t2;
 c | d
---+---
 4 | 5
 7 | 3
 3 | 2
 1 | 1
 2 | 0
Intended output:
 a | b | c | d
---+---+---+---
 2 | 2 | 4 | 5
 3 | 5 | 7 | 3
 4 | 7 | 3 | 2
 9 | 0 | 1 | 1
   |   | 2 | 0
Each table has no keys (and no OIDs). Order is not important, but each 
row from each table needs to be displayed exactly once.

--
dave
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] German "umlaut insensitive" query

2004-09-01 Thread Michael Kleiser
One solution:
select replace( replace( replace( replace( 'Test ä ö ü ß', 'ä','ae'), 'ö','oe' ), 
'ü','ue'), 'ß','ss' );
 replace
--
 Test ae oe ue ss
If you also have upcase-characters, you have to extend the statement.
Robert Strötgen schrieb:
I want to query words with German "umlauts" (special characters) with
and without normalization. I want to find "grün" (green) written
"gruen" as well.
Using "LIKE" with locale de_DE.iso88591 or .utf-8 does not help (Locale 
support should affect "LIKE",
http://www.postgresql.org/docs/7.3/static/charset.html#AEN21761).

Any Idea how to solve this? Define a special Operator? Has anyone
already done this before?
I am using PostgreSQL 7.3.2 on Linux.
TIA,
Robert Strötgen. :)
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster