pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
\d don't print all the tables
5+ messages / 5 participants
[nested] [flat]

* \d don't print all the tables
@ 2023-07-24 02:25 Wen Yi <wen-yi@qq.com>
  2023-07-24 09:51 ` Re: \d don't print all the tables Antonio Čale <antonio.cale@gmail.com>
  2023-07-24 13:17 ` Re: \d don't print all the tables Ron <ronljohnsonjr@gmail.com>
  2023-07-24 13:42 ` Re: \d don't print all the tables Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Wen Yi @ 2023-07-24 02:25 UTC (permalink / raw)
  To: pgsql-general <pgsql-general@lists.postgresql.org>

Hi community,
here's my shell:



postgres=# \d
Did not find any relations.
postgres=# create schema namespace_a;
CREATE SCHEMA
postgres=# create schema namespace_b;
CREATE SCHEMA
postgres=# create table simple (name varchar);
CREATE TABLE
postgres=# create table namespace_a.simple (name varchar);
CREATE TABLE
postgres=# create table namespace_b.simple (name varchar);
CREATE TABLE
postgres=# \d
         List of relations
 Schema |  Name  | Type  |  Owner   
--------+--------+-------+----------
 public | simple | table | postgres
(1 row)

postgres=# 


I think it should print the table on namespace_a & namespace_b, not just public, it really confused me.
Can someone give me some advice?



Yours,
Wen Yi.

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

* Re: \d don't print all the tables
  2023-07-24 02:25 \d don't print all the tables Wen Yi <wen-yi@qq.com>
@ 2023-07-24 09:51 ` Antonio Čale <antonio.cale@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Antonio Čale @ 2023-07-24 09:51 UTC (permalink / raw)
  To: Wen Yi <wen-yi@qq.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

Hi,

try: \d *.*
where: *.* = schema.table

Best regards / Cordialement / S pozdravem / S poštovanjem,
*Antonio Čale*


On Mon, Jul 24, 2023 at 11:43 AM Wen Yi <wen-yi@qq.com> wrote:

> Hi community,
> here's my shell:
>
> postgres=# \d
> Did not find any relations.
> postgres=# create schema namespace_a;
> CREATE SCHEMA
> postgres=# create schema namespace_b;
> CREATE SCHEMA
> postgres=# create table simple (name varchar);
> CREATE TABLE
> postgres=# create table namespace_a.simple (name varchar);
> CREATE TABLE
> postgres=# create table namespace_b.simple (name varchar);
> CREATE TABLE
> postgres=# \d
>          List of relations
>  Schema |  Name  | Type  |  Owner
> --------+--------+-------+----------
>  public | simple | table | postgres
> (1 row)
>
> postgres=#
>
> I think it should print the table on namespace_a & namespace_b, not just
> public, it really confused me.
> Can someone give me some advice?
>
> Yours,
> Wen Yi.
>

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

* Re: \d don't print all the tables
  2023-07-24 02:25 \d don't print all the tables Wen Yi <wen-yi@qq.com>
@ 2023-07-24 13:17 ` Ron <ronljohnsonjr@gmail.com>
  2023-07-24 14:17   ` Re: \d don't print all the tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  2 siblings, 1 reply; 5+ messages in thread

From: Ron @ 2023-07-24 13:17 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 7/23/23 21:25, Wen Yi wrote:
> Hi community,
> here's my shell:
>
> postgres=# \d
> Did not find any relations.
> postgres=# create schema namespace_a;
> CREATE SCHEMA
> postgres=# create schema namespace_b;
> CREATE SCHEMA
> postgres=# create table simple (name varchar);
> CREATE TABLE
> postgres=# create table namespace_a.simple (name varchar);
> CREATE TABLE
> postgres=# create table namespace_b.simple (name varchar);
> CREATE TABLE
> postgres=# \d
>          List of relations
>  Schema |  Name  | Type  |  Owner
> --------+--------+-------+----------
>  public | simple | table | postgres
> (1 row)
>
> postgres=#
>
> I think it should print the table on namespace_a & namespace_b, not just 
> public, it really confused me.
> Can someone give me some advice?

Add namespace_a and namespace_b to your search_path.  Then it will work.

Off the top of my head:
SET search_path = namespace_a, namespace_b, public;

-- 
Born in Arizona, moved to Babylonia.





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

* Re: \d don't print all the tables
  2023-07-24 02:25 \d don't print all the tables Wen Yi <wen-yi@qq.com>
  2023-07-24 13:17 ` Re: \d don't print all the tables Ron <ronljohnsonjr@gmail.com>
@ 2023-07-24 14:17   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Alvaro Herrera @ 2023-07-24 14:17 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On 2023-Jul-24, Ron wrote:

> Add namespace_a and namespace_b to your search_path.  Then it will work.
> 
> Off the top of my head:
> SET search_path = namespace_a, namespace_b, public;

Actually it won't, because the table in the earliest schema "shadows"
any other tables of the same name in later schemas, so they won't show
in \d either.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"XML!" Exclaimed C++.  "What are you doing here? You're not a programming
language."
"Tell that to the people who use me," said XML.
https://burningbird.net/the-parable-of-the-languages/





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

* Re: \d don't print all the tables
  2023-07-24 02:25 \d don't print all the tables Wen Yi <wen-yi@qq.com>
@ 2023-07-24 13:42 ` Adrian Klaver <adrian.klaver@aklaver.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2023-07-24 13:42 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 7/23/23 19:25, Wen Yi wrote:
> Hi community,
> here's my shell:

> I think it should print the table on namespace_a & namespace_b, not just 
> public, it really confused me.
> Can someone give me some advice?

Read about search_path:

https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH

> 
> Yours,
> Wen Yi.

-- 
Adrian Klaver
adrian.klaver@aklaver.com






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


end of thread, other threads:[~2023-07-24 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 02:25 \d don't print all the tables Wen Yi <wen-yi@qq.com>
2023-07-24 09:51 ` Antonio Čale <antonio.cale@gmail.com>
2023-07-24 13:17 ` Ron <ronljohnsonjr@gmail.com>
2023-07-24 14:17   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2023-07-24 13:42 ` Adrian Klaver <adrian.klaver@aklaver.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