Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: datetime queries in postgres
- To: tlug@example.com
- Subject: Re: datetime queries in postgres
- From: Jake Morrison <jake_morrison@example.com>
- Date: Wed, 23 May 2001 04:02:43 -0700 (PDT)
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <3B0B9138.17272.001@example.com>
- Reply-To: Jacob.Morrison@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <pQisgD.A.bKB.Wj5C7@example.com>
- Resent-Sender: tlug-request@example.com
Viktor, I don't have much experience with Postgres, but I have seen wierd things like this with Oracle where it was necessary to explicitly tell Oracle how to parse the date string. You might have to explicitly tell Postgress that the constant is a datetime, e.g. SELECT * FROM tb WHERE time > datetime '2000-05-18 8:00:00'; You might also need the leading 0 on the time, e.g. '2000-05-18 08:00:00' -Jake --- Viktor Pavlenko <vp@example.com> wrote: > I'm having some very strange problems in Postgres (7.0.2) > > There's a DATETIME field in the table. Most of queries with > this field give wrong results: > > >SELECT time FROM tb; > > 2001-05-18 07:45:26+09 > 2001-05-18 07:45:28+09 > 2001-05-18 08:58:06+09 > 2001-05-18 08:58:06+09 > > >SELECT * FROM tb WHERE time > '2000-05-18 8:00:00'; > > 2001-05-18 07:45:26+09 > 2001-05-18 07:45:28+09 > 2001-05-18 08:58:06+09 > 2001-05-18 08:58:06+09 > > >SELECT * FROM tb WHERE time < '2000-05-18 8:00:00'; > > (0 rows) > > Adding +9 to the time string doesn't change anything. > (and I omit the one I started with, BETWEEN thing) > > What am I doing wrong? > > Viktor > > ----------------------------------------------------------------------- > Next Technical Meeting: Sat, May 12 13:30- > Next Nomikai Meeting: Fri, June (TBA) 19:30- Tengu Tokyo Eki Mae > ----------------------------------------------------------------------- > more info: http://www.tlug.gr.jp Sponsor: Global Online > Japan > __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
- References:
- datetime queries in postgres
- From: vp@example.com (Viktor Pavlenko)
Home | Main Index | Thread Index
- Prev by Date: Re: REGEXP in perl questiion
- Next by Date: Re: Mini-nomikai Friday
- Prev by thread: datetime queries in postgres
- Next by thread: Re: datetime queries in postgres
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links