pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedWhy not used standart SQL commands?
7+ messages / 6 participants
[nested] [flat]
* Why not used standart SQL commands?
@ 2022-01-08 18:25 Ali Koca <kinetixcicocuk@gmail.com>
0 siblings, 5 replies; 7+ messages in thread
From: Ali Koca @ 2022-01-08 18:25 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
I'm seeing \dt used for "show tables", \l used for "show databases". Why
not standart SQL syntax words? Why specified PostgreSQL commands?
I can't figure out that.
Ali
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-08 18:28 David G. Johnston <david.g.johnston@gmail.com>
parent: Ali Koca <kinetixcicocuk@gmail.com>
4 siblings, 0 replies; 7+ messages in thread
From: David G. Johnston @ 2022-01-08 18:28 UTC (permalink / raw)
To: Ali Koca <kinetixcicocuk@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On Saturday, January 8, 2022, Ali Koca <kinetixcicocuk@gmail.com> wrote:
> Hello,
>
> I'm seeing \dt used for "show tables", \l used for "show databases". Why
> not standart SQL syntax words? Why specified PostgreSQL commands?
> I can't figure out that.
Less characters to type (and remember). Assuming psql is available is
reasonable given the forum. Also, the output is generally better.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-08 18:30 Tom Lane <tgl@sss.pgh.pa.us>
parent: Ali Koca <kinetixcicocuk@gmail.com>
4 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2022-01-08 18:30 UTC (permalink / raw)
To: Ali Koca <kinetixcicocuk@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Ali Koca <kinetixcicocuk@gmail.com> writes:
> I'm seeing \dt used for "show tables", \l used for "show databases". Why
> not standart SQL syntax words? Why specified PostgreSQL commands?
> I can't figure out that.
"show tables" isn't standard either.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-08 18:34 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Ali Koca <kinetixcicocuk@gmail.com>
4 siblings, 0 replies; 7+ messages in thread
From: Adrian Klaver @ 2022-01-08 18:34 UTC (permalink / raw)
To: Ali Koca <kinetixcicocuk@gmail.com>; pgsql-general@lists.postgresql.org
On 1/8/22 10:25, Ali Koca wrote:
> Hello,
>
> I'm seeing \dt used for "show tables", \l used for "show databases". Why
> not standart SQL syntax words? Why specified PostgreSQL commands?
> I can't figure out that.
AFAIK, SHOW TABLES is a MySQL thing.
See here:
https://www.sqltutorial.org/sql-list-all-tables/
If you are looking for a 'standard' method then look at:
https://www.postgresql.org/docs/current/information-schema.html
in particular:
https://www.postgresql.org/docs/current/infoschema-tables.html
>
> Ali
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-08 18:38 Tom Lane <tgl@sss.pgh.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Tom Lane @ 2022-01-08 18:38 UTC (permalink / raw)
To: Ali Koca <kinetixcicocuk@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
[ please keep the mailing list cc'd ]
Ali Koca <kinetixcicocuk@gmail.com> writes:
> How? I'm newbie
There is an ISO SQL standard, and "show" isn't in it.
Every SQL implementation has its own extensions of
the standard, as well as quirks and deviations from
the standard. It sounds like you're used to mysql's
extensions ... you'll need to learn about postgres's.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-08 22:18 Andreas 'ads' Scherbaum <ads@pgug.de>
parent: Ali Koca <kinetixcicocuk@gmail.com>
4 siblings, 0 replies; 7+ messages in thread
From: Andreas 'ads' Scherbaum @ 2022-01-08 22:18 UTC (permalink / raw)
To: Ali Koca <kinetixcicocuk@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Sat, Jan 8, 2022 at 7:25 PM Ali Koca <kinetixcicocuk@gmail.com> wrote:
> Hello,
>
> I'm seeing \dt used for "show tables", \l used for "show databases". Why
> not standart SQL syntax words? Why specified PostgreSQL commands?
> I can't figure out that.
>
As others pointed out, "show databases" and "show tables" are not from any
standard.
Since you seem to come from MySQL, here is a list terms translated to
PostgreSQL:
https://wiki.postgresql.org/wiki/MySQL_PostgreSQL_terminology
Regards,
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why not used standart SQL commands?
@ 2022-01-10 07:47 Nicklas Avén <nicklas.aven@jordogskog.no>
parent: Ali Koca <kinetixcicocuk@gmail.com>
4 siblings, 0 replies; 7+ messages in thread
From: Nicklas Avén @ 2022-01-10 07:47 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Den 2022-01-08 kl. 19:25, skrev Ali Koca:
> Hello,
>
> I'm seeing \dt used for "show tables", \l used for "show databases". Why
> not standart SQL syntax words? Why specified PostgreSQL commands?
> I can't figure out that.
>
> Ali
>
>
The psql backslash commands is just helper commands that wraps the
actual sql. With the -E, --echo-hidden option when starting psql you can
see the real sql.
The \dt command for instance uses this query:
SELECT n.nspname as "Schema",
c.relname as "Name",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm'
THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence'
WHEN 's' THEN 'special' WHEN 't' THEN 'TOAST table' WHEN 'f' THEN
'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN
'partitioned index' END as "Type",
pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_catalog.pg_am am ON am.oid = c.relam
WHERE c.relkind IN ('r','p','')
AND n.nspname <> 'pg_catalog'
AND n.nspname !~ '^pg_toast'
AND n.nspname <> 'information_schema'
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
/Nicklas Avén
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2022-01-10 07:47 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08 18:25 Why not used standart SQL commands? Ali Koca <kinetixcicocuk@gmail.com>
2022-01-08 18:28 ` David G. Johnston <david.g.johnston@gmail.com>
2022-01-08 18:30 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-01-08 18:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-01-08 18:34 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-01-08 22:18 ` Andreas 'ads' Scherbaum <ads@pgug.de>
2022-01-10 07:47 ` Nicklas Avén <nicklas.aven@jordogskog.no>
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