public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Fetter <[email protected]>
To: Josh Berkus <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Missing doc on expression format for ALTER TABLE
Date: Mon, 28 Mar 2005 08:22:44 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Sun, Mar 27, 2005 at 09:50:47PM -0800, Josh Berkus wrote:
> Guys,
> 
> > > Well, yes, actually.  Where in the documentation is a type
> > > conversion expression defined?   Do we use NEW and OLD?  Or the
> > > name of the column?  Or something else?
> >
> > I think the ALTER TABLE page is in dire need of a "See also"
> > section, at least.  And a reference to where <expression> is
> > defined would be nice to have.
> 
> What I'm pointing out here is that the USING clause can't be just
> ANY expression, it needs to be a specific type of expression.   And
> the docs don't explain what kind of expression is usable here.
> Even a single example would go a long way ...

I sent a patch in awhile ago that added this:

"To change an integer column containing UNIX timestamps to timestamp
with time zone via a USING clause:

ALTER TABLE foo
    ALTER COLUMN foo_timestamp TYPE timestamp with time zone
    USING
        timestamp with time zone 'epoch' + foo_timestamp * interval '1 second';
"

That is at least something, although I agree that more examples of the
exact kind of expression would be a very good thing.

Cheers,
D
-- 
David Fetter [email protected] http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!




view thread (6+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Missing doc on expression format for ALTER TABLE
  In-Reply-To: <[email protected]>

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

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