pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
4.2.9. Type Casts - documentation improvement
6+ messages / 6 participants
[nested] [flat]

* 4.2.9. Type Casts - documentation improvement
@ 2017-09-05 02:17 artejera@gmail.com
  2017-09-12 22:33 ` Re: 4.2.9. Type Casts - documentation improvement Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 6+ messages in thread

From: artejera@gmail.com @ 2017-09-05 02:17 UTC (permalink / raw)
  To: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.2/static/sql-syntax.html
Description:

Hi,

There seems to be no explicit documentation of the useful construct:

Select tt.*::text from tt

Also related:  4.2.13. Row Constructors

Congrats for your project. Yours AT

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: 4.2.9. Type Casts - documentation improvement
  2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
@ 2017-09-12 22:33 ` Bruce Momjian <bruce@momjian.us>
  2017-09-12 23:14   ` Re: 4.2.9. Type Casts - documentation improvement Steve Atkins <steve@blighty.com>
  2017-09-13 00:09   ` Re: 4.2.9. Type Casts - documentation improvement Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Bruce Momjian @ 2017-09-12 22:33 UTC (permalink / raw)
  To: artejera@gmail.com; +Cc: pgsql-docs

On Tue, Sep  5, 2017 at 02:17:12AM +0000, artejera@gmail.com wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/9.2/static/sql-syntax.html
> Description:
> 
> Hi,
> 
> There seems to be no explicit documentation of the useful construct:
> 
> Select tt.*::text from tt
> 
> Also related:  4.2.13. Row Constructors
> 
> Congrats for your project. Yours AT

Woh, I was not aware that worked, e.g.:

	test=> SELECT pg_language.*::text FROM pg_language;
	             pg_language
	-------------------------------------
	 (internal,10,f,f,0,0,2246,)
	 (c,10,f,f,0,0,2247,)
	 (sql,10,f,t,0,0,2248,)
	 (plpgsql,10,t,t,12319,12320,12321,)

Any idea where this should be documented.   It is useful?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: 4.2.9. Type Casts - documentation improvement
  2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
  2017-09-12 22:33 ` Re: 4.2.9. Type Casts - documentation improvement Bruce Momjian <bruce@momjian.us>
@ 2017-09-12 23:14   ` Steve Atkins <steve@blighty.com>
  2017-09-12 23:53     ` Re: 4.2.9. Type Casts - documentation improvement David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Steve Atkins @ 2017-09-12 23:14 UTC (permalink / raw)
  To: pgsql-docs


> On Sep 12, 2017, at 3:33 PM, Bruce Momjian <bruce@momjian.us> wrote:
> 
> On Tue, Sep  5, 2017 at 02:17:12AM +0000, artejera@gmail.com wrote:
>> The following documentation comment has been logged on the website:
>> 
>> Page: https://www.postgresql.org/docs/9.2/static/sql-syntax.html
>> Description:
>> 
>> Hi,
>> 
>> There seems to be no explicit documentation of the useful construct:
>> 
>> Select tt.*::text from tt
>> 
>> Also related:  4.2.13. Row Constructors
>> 
>> Congrats for your project. Yours AT
> 
> Woh, I was not aware that worked, e.g.:
> 
> 	test=> SELECT pg_language.*::text FROM pg_language;
> 	             pg_language
> 	-------------------------------------
> 	 (internal,10,f,f,0,0,2246,)
> 	 (c,10,f,f,0,0,2247,)
> 	 (sql,10,f,t,0,0,2248,)
> 	 (plpgsql,10,t,t,12319,12320,12321,)
> 
> Any idea where this should be documented.   It is useful?

It's the output format of a composite type, isn't it?

steve=# select pg_language from pg_language;
             pg_language
-------------------------------------
 (internal,10,f,f,0,0,2246,)
 (c,10,f,f,0,0,2247,)
 (sql,10,f,t,0,0,2248,)
 (plpgsql,10,t,t,12656,12657,12658,)
(4 rows)

https://www.postgresql.org/docs/current/static/rowtypes.html might be the place to expand on it, if so. (And converting to hstore or json or csv are other useful things to discuss too, maybe).

Cheers,
  Steve

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: 4.2.9. Type Casts - documentation improvement
  2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
  2017-09-12 22:33 ` Re: 4.2.9. Type Casts - documentation improvement Bruce Momjian <bruce@momjian.us>
  2017-09-12 23:14   ` Re: 4.2.9. Type Casts - documentation improvement Steve Atkins <steve@blighty.com>
@ 2017-09-12 23:53     ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2017-09-12 23:53 UTC (permalink / raw)
  To: Steve Atkins <steve@blighty.com>; +Cc: pgsql-docs

On Tue, Sep 12, 2017 at 4:14 PM, Steve Atkins <steve@blighty.com> wrote:

>
> > On Sep 12, 2017, at 3:33 PM, Bruce Momjian <bruce@momjian.us> wrote:
> >
> > On Tue, Sep  5, 2017 at 02:17:12AM +0000, artejera@gmail.com wrote:
> >> The following documentation comment has been logged on the website:
> >>
> >> Page: https://www.postgresql.org/docs/9.2/static/sql-syntax.html
> >> Description:
> >>
> >> Hi,
> >>
> >> There seems to be no explicit documentation of the useful construct:
> >>
> >> Select tt.*::text from tt
> >>
> >> Also related:  4.2.13. Row Constructors
> >>
> >> Congrats for your project. Yours AT
> >
> > Woh, I was not aware that worked, e.g.:
> >
> >       test=> SELECT pg_language.*::text FROM pg_language;
> >                    pg_language
> >       -------------------------------------
> >        (internal,10,f,f,0,0,2246,)
> >        (c,10,f,f,0,0,2247,)
> >        (sql,10,f,t,0,0,2248,)
> >        (plpgsql,10,t,t,12319,12320,12321,)
> >
> > Any idea where this should be documented.   It is useful?
>
> It's the output format of a composite type, isn't it?
>
> steve=# select pg_language from pg_language;
>              pg_language
> -------------------------------------
>  (internal,10,f,f,0,0,2246,)
>  (c,10,f,f,0,0,2247,)
>  (sql,10,f,t,0,0,2248,)
>  (plpgsql,10,t,t,12656,12657,12658,)
> (4 rows)
>
> https://www.postgresql.org/docs/current/static/rowtypes.html might be the
> place to expand on it, if so. (And converting to hstore or json or csv are
> other useful things to discuss too, maybe).
>

​​Put another way, the .* is unnecessary - an artifact of parsing
implementation allows it to be present.

For me, "compositetype::text" casting, while not explicitly elaborated upon
in our documentation, makes sense given that one can reasonably assume that
(probably) all data types can be round-trip casted to text.  The text
representation of a composite type is documented.

I cannot think of anything that the docs need to become more complete in
this area; and they don't purport to be a "teacher of useful techniques" in
the application of SQL.  While I've complained about the lack of "why"
discussion in the docs there is merit in focusing them on "what" and "how"
and leaving why to alternative mediums - ones whose release cycles are more
flexible and don't require a hacker to commit.

David J.
​​

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: 4.2.9. Type Casts - documentation improvement
  2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
  2017-09-12 22:33 ` Re: 4.2.9. Type Casts - documentation improvement Bruce Momjian <bruce@momjian.us>
@ 2017-09-13 00:09   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-13 18:22     ` Re: 4.2.9. Type Casts - documentation improvement Ariel Tejera Molina <artejera@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2017-09-13 00:09 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: artejera@gmail.com; pgsql-docs

Bruce Momjian <bruce@momjian.us> writes:
> Any idea where this should be documented.   It is useful?

Section 8.16.5 is pretty exhaustive already.  I'm not convinced
that this particular case needs to be mentioned explicitly.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: 4.2.9. Type Casts - documentation improvement
  2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
  2017-09-12 22:33 ` Re: 4.2.9. Type Casts - documentation improvement Bruce Momjian <bruce@momjian.us>
  2017-09-13 00:09   ` Re: 4.2.9. Type Casts - documentation improvement Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-09-13 18:22     ` Ariel Tejera Molina <artejera@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Ariel Tejera Molina @ 2017-09-13 18:22 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-docs

Hi,

8.16.5 is perfect.  Thanks

Saludos,
Ariel Tejera Molina

2017-09-12 19:09 GMT-05:00 Tom Lane <tgl@sss.pgh.pa.us>:

> Bruce Momjian <bruce@momjian.us> writes:
> > Any idea where this should be documented.   It is useful?
>
> Section 8.16.5 is pretty exhaustive already.  I'm not convinced
> that this particular case needs to be mentioned explicitly.
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2017-09-13 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05 02:17 4.2.9. Type Casts - documentation improvement artejera@gmail.com
2017-09-12 22:33 ` Bruce Momjian <bruce@momjian.us>
2017-09-12 23:14   ` Steve Atkins <steve@blighty.com>
2017-09-12 23:53     ` David G. Johnston <david.g.johnston@gmail.com>
2017-09-13 00:09   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-13 18:22     ` Ariel Tejera Molina <artejera@gmail.com>

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