How to get PostgreSQL column list and datatypes of that table? How Postgres get column names works using macro?
From the following sql query we can get the all column names and datatype of table in PostgreSQL. Postgres get column names select the column names from the information_schema.columns system table.
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TABLE_NAME';
How to add macro in PgAdminIII for using Alt+F1 shortcut key | Postgres show tables details using ALT F1
In Microsoft SQL Alt+F1 using for table information. Like using Alt+F1 in PostgreSQL we can get the details of a table by adding the macros. We can use macros for using shortcut keys in PostgreSQL PgAdminIII. For adding macros open PostgreSQL query window select the "Manage macros" menu from "Macros"
When we select the "Manage macros" a pop-up window will be displayed like below.
Click on Alt+F1, give a name for the macro and copy and paste the below displayed sql query.
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = LOWER('$SELECTION$');
Then save the details
Select a table and press Alt+F1, you will get the details of that table like above displayed image. Postgres get column names.
Please visit other related articles
PostgreSQL: Export PostgreSQL data in to excel file
PostgreSQL: How to restrict the user access to the databases in Postgresql based on the permission
PostgreSQL: List table details using Alt+F1 in PostgreSQL
PostgreSQL: How to get ROW_COUNT of last executed query in PostgreSQL like MS SQL @@ROWCOUNT ?
1 comment:
ReplyDelete