Missing rows in resultset

Started by Björn Lundinover 15 years ago3 messagesgeneral
Jump to latest
#1Björn Lundin
b.f.lundin@gmail.com

I got a table holding tv air time but I got a unexpected (to me)
behaviour.
Using like, I do not get the recordset I'd like.

I've installed it using mac-ports on an old mac-mini, ppc

I'd expect to see the same rows with wildcard, as I see without, see
below

Or is it just beeing late, and me being blind?

eyetv=# select version();

version

-----------------------------------------------------------------------------------------------------------------------------------
---------
PostgreSQL 8.4.4 on powerpc-apple-darwin9.8.0, compiled by GCC
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
, 32-bit
(1 row)

Time: 0.724 ms
eyetv=# select * from programmes where title like 'Star Wars';
        start        |        stop         |   channel    |   title
| category |         episode          |  description
---------------------+---------------------+--------------+-----------
+----------+--------------------------+---------------
 2010-09-04 19:00:00 | 2010-09-04 19:30:00 | tv400.tv4.se | Star Wars
| series   | Del 7 av 22 säsong 2009  | Del 7 av 22.
 2010-09-04 19:30:00 | 2010-09-04 20:00:00 | tv400.tv4.se | Star Wars
| series   | Del 8 av 22 säsong 2009  | Del 8 av 22.
 2010-09-05 23:50:00 | 2010-09-06 00:20:00 | tv400.tv4.se | Star Wars
| series   | Del 7 av 22 säsong 2009  | Del 7 av 22.
 2010-09-06 00:20:00 | 2010-09-06 00:45:00 | tv400.tv4.se | Star Wars
| series   | Del 8 av 22 säsong 2009  | Del 8 av 22.
 2010-09-11 19:00:00 | 2010-09-11 19:30:00 | tv400.tv4.se | Star Wars
| series   | Del 9 av 22 säsong 2009  | Del 9 av 22.
 2010-09-11 19:30:00 | 2010-09-11 20:00:00 | tv400.tv4.se | Star Wars
| series   | Del 10 av 22 säsong 2009 | Del 10 av 22.
 2010-08-28 19:00:00 | 2010-08-28 19:30:00 | tv400.tv4.se | Star Wars
| series   | Del 5 av 22 säsong 2009  | Del 5 av 22.
 2010-08-28 19:30:00 | 2010-08-28 20:00:00 | tv400.tv4.se | Star Wars
| series   | Del 6 av 22 säsong 2009  | Del 6 av 22.
 2010-08-29 23:40:00 | 2010-08-30 00:10:00 | tv400.tv4.se | Star Wars
| series   | Del 5 av 22 säsong 2009  | Del 5 av 22.
 2010-08-30 00:10:00 | 2010-08-30 00:40:00 | tv400.tv4.se | Star Wars
| series   | Del 6 av 22 säsong 2009  | Del 6 av 22.
(10 rows)

Time: 108.087 ms
eyetv=# select * from programmes where title like 'Star*';
start | stop | channel | title | category | episode | description
-------+------+---------+-------+----------+---------+-------------
(0 rows)

Time: 82.176 ms
eyetv=# \d programmes
Table "public.programmes"
Column | Type | Modifiers
-------------+-----------------------------+-----------
start | timestamp without time zone | not null
stop | timestamp without time zone | not null
channel | text | not null
title | text | not null
category | text |
episode | text |
description | text |
Indexes:
"programmes_pkey" PRIMARY KEY, btree (start, stop, channel)

eyetv=#

/Björn

#2Björn Lundin
b.f.lundin@gmail.com
In reply to: Björn Lundin (#1)
Re: Missing rows in resultset

On 30 Aug, 00:02, björn lundin <b.f.lun...@gmail.com> wrote:

Or is it just beeing late, and me being blind?
eyetv=# select * from programmes where title like 'Star*';

It was of course me being blind...

select * from programmes where title like 'Star%';
is the correct way.
Wrong wildcard character '%' instead of '*'
Sorry for the noise

/Björn

#3Alan Hodgson
ahodgson@simkin.ca
In reply to: Björn Lundin (#1)
Re: Missing rows in resultset

On Sunday, August 29, 2010, björn lundin <b.f.lundin@gmail.com> wrote:

eyetv=# select * from programmes where title like 'Star*';

* isn't the SQL wildcard character. % is.

--
"No animals were harmed in the recording of this episode. We tried but that
damn monkey was just too fast."