Re: [SQL] Differentiate Between Zero-Length String and NULLColumn Values

2007-01-30 Thread Tomas Vondra
> On Tue, Jan 30, 2007 at 02:38:07PM +0100, Bart Degryse wrote: > >> Andrew, I think you're wrong stating that Oracle would interpret >> NULL and empty string as equal. The Oracle databases I use (8, 9 >> and 10) certainly make a distiction between both values. Maybe >> earlier versions did so, th

[SQL] implementing (something like) UNIQUE constraint using PL/pgSQL

2007-01-26 Thread Tomas Vondra
Hello, in our application we need to implement a constraint that enforces 'at most N rows with this value', that is we have a table with 'flag' column and for each value there should be at most 10 rows (for example, the exact number does not matter). I'm trying to implement a PL/pgSQL trigge

Re: [SQL] help with pagila

2006-09-01 Thread Tomas Vondra
> So I can assume that the MySQL implementation is strange? (It accepts > that kind of query) Yes, MySQL behaves strangely in this case (as well as in several other cases). I wouldn't rely on this as it probably can choose different values each time (although as far as I remember I haven't seen th

Re: [SQL] help with pagila

2006-09-01 Thread Tomas Vondra
> But, when I add another column on select, like, film_description, I get > the following error: > > "ERROR: column "film.description" must appear in the GROUP BY clause or > be used in an aggregate function" > > If I put that column on GROUP BY everything works ok. But I want > understant why d

[SQL] problem comparing strings when different cluster / database encoding

2006-04-05 Thread Tomas Vondra
Greetings, I've encountered a strange problem. We have a PG 8.0.x database cluster (in the sense used in initdb, i.e. bunch of databases) created with UNICODE encoding, namely cs_CZ.UTF-8 locale. When a database is created with a different encoding (in our case it's LATIN2) the string comparison

[SQL] how to transform list to table and evaluate an expression on it?

2006-01-07 Thread Tomas Vondra
Hello, in several apps running over postgres 8.0/8.1 I've used following "full-text" search engine - imagine there are two tables: 1) Documents - with "docId", "title", "abstract" and "body" columns 2) Index - with "docId", "word" and "score" It's very easy to build the Index from the Documents