Just use the name (or alias) of table t directly:
SELECT t::text FROM t
t.* will be used to decompose the line, but since you are passing the entire line to text, this step is excess noise.
cast is possible because everything can be added to text in Postgres. (There must be a text representation for input / output.)
You get a textual representation of the string anyway. That is, the output is a valid string literal, which you can return back to the registered string type, for example:
SELECT '(123,"some text",,"2017-01-03 02:27:27.930164+01")'::t
t is the name of the table or the (materialized) view (visible in the current search_path or you have for the schema) or any other registered (string) type.
This works with table names out of the box because Postgres registers the row type for each table created.
Note. For anonymous entries (for example, ROW(1,2) or simply (1,2) ), t.* Notation or rollback is not possible to denote anonymous entries. There is no information on their structure in system catalogs.
on this topic:
source share