pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: BACHELART PIERRE (CIS/SCC) <pierre.bachelart@belgacom.be>
To: BACHELART PIERRE (CIS/SCC) <pierre.bachelart@belgacom.be>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: matching a timestamp field
Date: Thu, 20 Sep 2012 12:21:56 +0000
Message-ID: <3C56CD7AD881324BB4C60AA5CE2C5CC1172001FC@A04059.BGC.NET> (raw)
In-Reply-To: <3C56CD7AD881324BB4C60AA5CE2C5CC11720019A@A04059.BGC.NET>
References: <3C56CD7AD881324BB4C60AA5CE2C5CC11720019A@A04059.BGC.NET>

Hello,

The solution I just found on the Net (Thanks to Samuel Gendler)

ansroc=# select * from s12hwdb where record::text ~ '2012-09-20 11:50:02' limit 5;
   host   | exchange |   rit   |  board   | var  | lceid | pceid | mnem  | eq | rtyp | rv |  cetype  |       record        | type | zone
----------+----------+---------+----------+------+-------+-------+-------+----+------+----+----------+---------------------+------+------
and5032t | and5032t | 01a0301 | 21122994 | ebjb | 0000  | 000c  | con3a | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0307 | 21406298 | aaca | 0000  | 000c  | mmca  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0309 | 21406298 | aaca | 0000  | 000c  | mmca  | s  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0311 | 21407930 | aaaa | 0000  | 000c  | mmcb  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0313 | 21407932 | abca | 0000  | 000c  | mcud  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
(5 rows)

But I still can not find this in the doc.


From: BACHELART PIERRE (CIS/SCC) [mailto:pierre.bachelart@belgacom.be]
Sent: Thursday 20 September 2012 13:01
To: pgsql-sql@postgresql.org
Subject: matching a timestamp field

Hello,


Why is my sql below accepted in 8.1.19 and refused in 8.4.9 ???
Is there something I have missed in the doc ?


Welcome to psql 8.1.19, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

ansroc=# select * from s12hwdb where record ~'2012-09-20' limit 5;
   host   | exchange |   rit   |  board   | var  | lceid | pceid | mnem  | eq | rtyp | rv |  cetype  |       record        | type | zone
----------+----------+---------+----------+------+-------+-------+-------+----+------+----+----------+---------------------+------+------
and5032t | and5032t | 01a0301 | 21122994 | ebjb | 0000  | 000c  | con3a | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0307 | 21406298 | aaca | 0000  | 000c  | mmca  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0309 | 21406298 | aaca | 0000  | 000c  | mmca  | s  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0311 | 21407930 | aaaa | 0000  | 000c  | mmcb  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
and5032t | and5032t | 01a0313 | 21407932 | abca | 0000  | 000c  | mcud  | e  | ef03 | b1 | plce#xfx | 2012-09-20 11:50:02 | H    | a1
(5 rows)

ansroc=# \q



psql (8.4.9)
Type "help" for help.
ansroc=# select * from s12hwdb where record ~'2012-09-20' limit 5;
ERROR:  operator does not exist: timestamp without time zone ~ unknown
LINE 1: select * from s12hwdb where record ~'2012-09-20' limit 5;
                                           ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
ansroc=#




Pierre.
+32 471 68 12 23


________________________________

***** Disclaimer *****
http://www.belgacom.be/maildisclaimer

view thread (4+ messages)  latest in thread

Message-ID: <3C56CD7AD881324BB4C60AA5CE2C5CC1172001FC@A04059.BGC.NET>
Permalink:  ../3C56CD7AD881324BB4C60AA5CE2C5CC1172001FC@A04059.BGC.NET/
Also on:    postgresql.org/message-id/3C56CD7AD881324BB4C60AA5CE2C5CC1172001FC@A04059.BGC.NET

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pierre.bachelart@belgacom.be
  Subject: Re: matching a timestamp field
  In-Reply-To: <3C56CD7AD881324BB4C60AA5CE2C5CC1172001FC@A04059.BGC.NET>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox