Обсуждение: timestamptz alias

Поиск
Список
Период
Сортировка

timestamptz alias

От
Markus Schaber
Дата:
Hi,

I'm happy that the rather verbose "timestamp with time zone" has the
much nicer alias "timestamptz", however it seems that this alias is not
documented, neither at
http://developer.postgresql.org/pgdocs/postgres/datatype-datetime.html
nor at http://www.postgresql.org/docs/8.1/interactive/datatype-datetime.html

I see it mentioned at
http://www.postgresql.org/docs/8.1/interactive/datatype.html but that's
possibly not where people look at first, when they search for the
timestamp type. (At least I found it only when grepping for
"timestamptz" in the docs. :-)

Should the alias be mentioned on the datetime page? The same for timetz?
What do you think?

Thanks,
Markus


Re: timestamptz alias

От
AgentM
Дата:
On Oct 2, 2006, at 18:15 , Markus Schaber wrote:

> Hi,
>
> I'm happy that the rather verbose "timestamp with time zone" has the
> much nicer alias "timestamptz", however it seems that this alias is  
> not
> documented, neither at
> http://developer.postgresql.org/pgdocs/postgres/datatype-datetime.html
> nor at http://www.postgresql.org/docs/8.1/interactive/datatype- 
> datetime.html
>
> I see it mentioned at
> http://www.postgresql.org/docs/8.1/interactive/datatype.html but  
> that's
> possibly not where people look at first, when they search for the
> timestamp type. (At least I found it only when grepping for
> "timestamptz" in the docs. :-)
>
> Should the alias be mentioned on the datetime page? The same for  
> timetz?
> What do you think?

I am pleased that the documentation promotes database-independent   
("standard") SQL.

-M


Re: timestamptz alias

От
Jim Nasby
Дата:
On Oct 2, 2006, at 6:22 PM, AgentM wrote:
> On Oct 2, 2006, at 18:15 , Markus Schaber wrote:
>> I'm happy that the rather verbose "timestamp with time zone" has the
>> much nicer alias "timestamptz", however it seems that this alias  
>> is not
>> documented, neither at
>> http://developer.postgresql.org/pgdocs/postgres/datatype- 
>> datetime.html
>> nor at http://www.postgresql.org/docs/8.1/interactive/datatype- 
>> datetime.html
>>
>> I see it mentioned at
>> http://www.postgresql.org/docs/8.1/interactive/datatype.html but  
>> that's
>> possibly not where people look at first, when they search for the
>> timestamp type. (At least I found it only when grepping for
>> "timestamptz" in the docs. :-)
>>
>> Should the alias be mentioned on the datetime page? The same for  
>> timetz?
>> What do you think?
>
> I am pleased that the documentation promotes database-independent   
> ("standard") SQL.

There's a difference between promoting and withholding info. I'd  
rather see us explicitly state which is preferred and why.

BTW, another confusing example is all the string functions that are  
essentially the same, such as substring and substr. (http:// 
www.postgresql.org/docs/8.1/interactive/functions-string.html)
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




Re: timestamptz alias

От
Markus Schaber
Дата:
Hi, Jim,

Jim Nasby wrote:

> There's a difference between promoting and withholding info. I'd rather
> see us explicitly state which is preferred and why.

Here's a small patch that adds an appropriate explanation.


Index: doc/src/sgml/datatype.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/datatype.sgml,v
retrieving revision 1.176
diff -u -r1.176 datatype.sgml
--- doc/src/sgml/datatype.sgml  22 Sep 2006 16:20:00 -0000      1.176
+++ doc/src/sgml/datatype.sgml  3 Oct 2006 09:14:32 -0000
@@ -1372,6 +1372,17 @@    </para>   </note>

+   <note>
+    <para>
+     <productname>PostgreSQL</productname> also supports the aliases
+     <type>timestamptz</type> for <type>timestamp with time zone</type>
+     and <type>timetz</type> for <type>time with time zone</type>. It
+     is recommended to avoid them, as the more verbose variants comply
+     to the SQL standard, and thus are more portable. But there are no
+     plans to drop the short aliases in future versions.
+    </para>
+   </note>
+   <para>    <type>time</type>, <type>timestamp</type>, and    <type>interval</type> accept an optional precision
value




HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org


Re: timestamptz alias

От
Tom Lane
Дата:
Markus Schaber <schabi@logix-tt.com> writes:
> Here's a small patch that adds an appropriate explanation.

If we're going to document these aliases, what of float4, float8, and bool?
Also, although the docs mention int2/int4/int8, it's more or less left
to the reader's imagination to deduce what they are.

Perhaps it'd be better to provide a small table of recognized type
aliases, rather than inserting equivalent notes into three or four places.
        regards, tom lane


Re: timestamptz alias

От
Andrew Dunstan
Дата:
Tom Lane wrote:
> Markus Schaber <schabi@logix-tt.com> writes:
>   
>> Here's a small patch that adds an appropriate explanation.
>>     
>
> If we're going to document these aliases, what of float4, float8, and bool?
> Also, although the docs mention int2/int4/int8, it's more or less left
> to the reader's imagination to deduce what they are.
>
> Perhaps it'd be better to provide a small table of recognized type
> aliases, rather than inserting equivalent notes into three or four places.
>
>     


you mean like the table here?  
http://momjian.us/main/writings/pgsql/sgml/datatype.html


cheers

andrew


Re: timestamptz alias

От
"Jim C. Nasby"
Дата:
Moving to -docs

On Tue, Oct 03, 2006 at 12:13:46PM -0400, Andrew Dunstan wrote:
> Tom Lane wrote:
> >Markus Schaber <schabi@logix-tt.com> writes:
> >
> >>Here's a small patch that adds an appropriate explanation.
> >>
> >
> >If we're going to document these aliases, what of float4, float8, and bool?
> >Also, although the docs mention int2/int4/int8, it's more or less left
> >to the reader's imagination to deduce what they are.
> >
> >Perhaps it'd be better to provide a small table of recognized type
> >aliases, rather than inserting equivalent notes into three or four places.
> >
> >
>
>
> you mean like the table here?
> http://momjian.us/main/writings/pgsql/sgml/datatype.html

An issue I've seen with the docs is that for chapters that have a lot of
sections (such as 8), the section list at the start of each chapter
fills the screen, so it's easy to miss the fact that there's more info
beneath the list (which is wy presumably most folks never knew that
table existed).

I think the ideal way to handle this would be to put the table of
contents in a side-bar and flow the text around it. But that could be a
real bear to do in docbook/sgml, so perhaps it would be better to just
force the TOC for each chapter onto it's own page (and ensure the
overview/introduction text shows up in the TOC).
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Re: timestamptz alias

От
Markus Schaber
Дата:
Hi, Tom,

Tom Lane wrote:

>> Here's a small patch that adds an appropriate explanation.
>
> If we're going to document these aliases, what of float4, float8, and bool?
> Also, although the docs mention int2/int4/int8, it's more or less left
> to the reader's imagination to deduce what they are.
>
> Perhaps it'd be better to provide a small table of recognized type
> aliases, rather than inserting equivalent notes into three or four places.

It's not only about documenting the pure existence of the aliases (which
was already documented in the table on the datatype TOC page), it's also
about telling the user which of the names are the ones to avoid, and the
reasons to do so.

HTH,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org


Re: timestamptz alias

От
Andrew Dunstan
Дата:
Markus Schaber wrote:
> It's not only about documenting the pure existence of the aliases (which
> was already documented in the table on the datatype TOC page), it's also
> about telling the user which of the names are the ones to avoid, and the
> reasons to do so.
>
>
>   

*blink* Why do any need to be avoided? What you use is a matter of 
taste, and your organisation's coding standards. From a purely technical 
POV I don't see any reason to avoid using either the canonical type 
names or the various aliases.

cheers

andrew



Re: timestamptz alias

От
Markus Schaber
Дата:
Hi, Andrew,

Andrew Dunstan wrote:

>> It's not only about documenting the pure existence of the aliases (which
>> was already documented in the table on the datatype TOC page), it's also
>> about telling the user which of the names are the ones to avoid, and the
>> reasons to do so.
>
> *blink* Why do any need to be avoided? What you use is a matter of
> taste, and your organisation's coding standards. From a purely technical
> POV I don't see any reason to avoid using either the canonical type
> names or the various aliases.

At least compatibility with the SQL standard, as well as with other
Databases might be a reason.

Using pure "timestamp" may lead human readers to be confused, because it
has both meanings with and without timezone historically, this might be
a reason to prefer the "timestamp with[out] time zone" wording.

HTH,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org


Re: timestamptz alias

От
Jim Nasby
Дата:
On Oct 4, 2006, at 10:52 AM, Markus Schaber wrote:
> Andrew Dunstan wrote:
>>> It's not only about documenting the pure existence of the aliases  
>>> (which
>>> was already documented in the table on the datatype TOC page),  
>>> it's also
>>> about telling the user which of the names are the ones to avoid,  
>>> and the
>>> reasons to do so.
>>
>> *blink* Why do any need to be avoided? What you use is a matter of
>> taste, and your organisation's coding standards. From a purely  
>> technical
>> POV I don't see any reason to avoid using either the canonical type
>> names or the various aliases.
>
> At least compatibility with the SQL standard, as well as with other
> Databases might be a reason.

It would be nice to denote types/aliases that are and aren't ANSI. A  
number are marked  in the docs, but it would be good to add the info  
to that summary table.
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




Re: timestamptz alias

От
"Andrew Dunstan"
Дата:
Jim Nasby wrote:
>
> It would be nice to denote types/aliases that are and aren't ANSI. A
> number are marked  in the docs, but it would be good to add the info
> to that summary table.

Right under the table this sentence appears:

Compatibility:  The following types (or spellings thereof) are specified
by SQL: bit, bit varying, boolean, char, character varying, character,
varchar, date, double precision, integer, interval, numeric, decimal,
real, smallint, time (with or without time zone), timestamp (with or
without time zone).

What's unclear about that?

cheers

andrew






Re: timestamptz alias

От
"Jim C. Nasby"
Дата:
On Fri, Oct 06, 2006 at 02:35:55AM -0500, Andrew Dunstan wrote:
> Jim Nasby wrote:
> >
> > It would be nice to denote types/aliases that are and aren't ANSI. A
> > number are marked  in the docs, but it would be good to add the info
> > to that summary table.
> 
> Right under the table this sentence appears:
> 
> Compatibility:  The following types (or spellings thereof) are specified
> by SQL: bit, bit varying, boolean, char, character varying, character,
> varchar, date, double precision, integer, interval, numeric, decimal,
> real, smallint, time (with or without time zone), timestamp (with or
> without time zone).
> 
> What's unclear about that?

Oops. This is what happens when I answer emails on a plane. :(
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)