On 25 August 2017 at 13:19, alain bourgeois <a.bourgeois@zetescards.be> wrote:
> But t1 is not in the select list... (and this doesn't work in oracle nor
> mariadb)... It is "strange" but not blocking.
You can refer to the whole table like you would with columns in a
query, so it's valid.
For example:
SELECT tablename
FROM tablename;
This will return the table's data as a single column, the type of
which is the table itself.
SELECT DISTINCT (tablename) tablename, count(*)
FROM tablename
GROUP BY tablename
HAVING count(*) > 1
ORDER BY tablename;
This will effectively show you which rows are duplicated, and how many
times they are duplicated.
And being able to pass the table to a function can be really useful.
For example:
SELECT to_jsonb(tablename) FROM tablename;
This will output the table data as JSON, and use the column names as the keys.
Thom