public inbox for [email protected]
help / color / mirror / Atom feedMissing doc on expression format for ALTER TABLE
6+ messages / 4 participants
[nested] [flat]
* Missing doc on expression format for ALTER TABLE
@ 2005-03-27 00:55 Josh Berkus <[email protected]>
2005-03-27 04:47 ` Re: Missing doc on expression format for ALTER TABLE Tom Lane <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Josh Berkus @ 2005-03-27 00:55 UTC (permalink / raw)
To: pgsql-docs
Folks,
I've noticed that this statement is missing something:
(from sql-altertable.sgml):
ALTER COLUMN TYPE
This form changes the type of a column of a table. Indexes and simple table
constraints involving the column will be automatically converted to use the
new column type by reparsing the originally supplied expression. The optional
USING clause specifies how to compute the new column value from the old; if
omitted, the default conversion is the same as an assignment cast from old
data type to new. A USING clause must be provided if there is no implicit or
assignment cast from old to new type.
... nowhere in this file (or anywhere else that I can tell) is the syntax for
the USING expression defined.
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Missing doc on expression format for ALTER TABLE
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
@ 2005-03-27 04:47 ` Tom Lane <[email protected]>
2005-03-28 01:11 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2005-03-27 04:47 UTC (permalink / raw)
To: [email protected]; +Cc: pgsql-docs
Josh Berkus <[email protected]> writes:
> ... nowhere in this file (or anywhere else that I can tell) is the syntax for
> the USING expression defined.
Hm? It says
ALTER [ COLUMN ] column TYPE type [ USING expression ]
Surely you're not expecting it to repeat the complete syntax for
<expression>.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Missing doc on expression format for ALTER TABLE
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-27 04:47 ` Re: Missing doc on expression format for ALTER TABLE Tom Lane <[email protected]>
@ 2005-03-28 01:11 ` Josh Berkus <[email protected]>
2005-03-28 02:00 ` Re: Missing doc on expression format for ALTER TABLE Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Josh Berkus @ 2005-03-28 01:11 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: pgsql-docs
Tom,
> ALTER [ COLUMN ] column TYPE type [ USING expression ]
>
> Surely you're not expecting it to repeat the complete syntax for
> <expression>.
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?
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Missing doc on expression format for ALTER TABLE
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-27 04:47 ` Re: Missing doc on expression format for ALTER TABLE Tom Lane <[email protected]>
2005-03-28 01:11 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
@ 2005-03-28 02:00 ` Alvaro Herrera <[email protected]>
2005-03-28 05:50 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Alvaro Herrera @ 2005-03-28 02:00 UTC (permalink / raw)
To: Josh Berkus <[email protected]>; +Cc: Tom Lane <[email protected]>; pgsql-docs
On Sun, Mar 27, 2005 at 05:11:43PM -0800, Josh Berkus wrote:
> > ALTER [ COLUMN ] column TYPE type [ USING expression ]
> >
> > Surely you're not expecting it to repeat the complete syntax for
> > <expression>.
>
> 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.
--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"All rings of power are equal,
But some rings of power are more equal than others."
(George Orwell's The Lord of the Rings)
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Missing doc on expression format for ALTER TABLE
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-27 04:47 ` Re: Missing doc on expression format for ALTER TABLE Tom Lane <[email protected]>
2005-03-28 01:11 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-28 02:00 ` Re: Missing doc on expression format for ALTER TABLE Alvaro Herrera <[email protected]>
@ 2005-03-28 05:50 ` Josh Berkus <[email protected]>
2005-03-28 16:22 ` Re: Missing doc on expression format for ALTER TABLE David Fetter <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Josh Berkus @ 2005-03-28 05:50 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; pgsql-docs
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 ...
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Missing doc on expression format for ALTER TABLE
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-27 04:47 ` Re: Missing doc on expression format for ALTER TABLE Tom Lane <[email protected]>
2005-03-28 01:11 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-28 02:00 ` Re: Missing doc on expression format for ALTER TABLE Alvaro Herrera <[email protected]>
2005-03-28 05:50 ` Re: Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
@ 2005-03-28 16:22 ` David Fetter <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: David Fetter @ 2005-03-28 16:22 UTC (permalink / raw)
To: Josh Berkus <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Tom Lane <[email protected]>; pgsql-docs
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!
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2005-03-28 16:22 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-27 00:55 Missing doc on expression format for ALTER TABLE Josh Berkus <[email protected]>
2005-03-27 04:47 ` Tom Lane <[email protected]>
2005-03-28 01:11 ` Josh Berkus <[email protected]>
2005-03-28 02:00 ` Alvaro Herrera <[email protected]>
2005-03-28 05:50 ` Josh Berkus <[email protected]>
2005-03-28 16:22 ` David Fetter <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox