Re: ? bug pg 9.6 - Mailing list pgadmin-support

From Thom Brown
Subject Re: ? bug pg 9.6
Date
Msg-id CAA-aLv5TZt0PQhLffiofBOw7wW_q7FCsYF29B-KEhHyKDKTfwQ@mail.gmail.com
Whole thread Raw
In response to Re: ? bug pg 9.6  ("alain bourgeois" <a.bourgeois@zetescards.be>)
List pgadmin-support
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


pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: ? bug pg 9.6
Next
From: Alban Hertroys
Date:
Subject: Dashboard gets stuck