Skip site navigation (1) Skip section navigation (2)

Re: Extract from date field

From: Thom Brown <thom(at)linux(dot)com>
To: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Extract from date field
Date: 2011-06-18 17:23:40
Message-ID: BANLkTik5Xy52MTf8h5h0kx-fJwLw3utPxg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On 18 June 2011 18:02, James David Smith <james(dot)david(dot)smith(at)gmail(dot)com> wrote:
> Thanks Thom.
>
> What does the ' ::int  ' bit do at the end?

That casts the whole lot to an int value so that it can be assigned to
the column you're updating.  Otherwise you could end up with an error
message saying the types don't match.

So ::int is equivalent to cast(column as int).

Thom

In response to

pgsql-novice by date

Next:From: Thom BrownDate: 2011-06-18 17:54:50
Subject: Re: Extract from date field
Previous:From: James David SmithDate: 2011-06-18 17:02:14
Subject: Re: Extract from date field

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group