psql

Run batch file with psql command without password

半城伤御伤魂 提交于 2019-11-26 02:03:20
I am trying to execute this psql command using a batch script: psql --host=localhost --dbname=<dbname> --port=<Port Number> --username=<dbuser> --file=C:\PSQL_Script.txt --output=C:\PSQL_Output.txt The problem is that it's asking for the password every time I execute the batch script. How can I password argument through the batch file? Keep reading, the best options come last . But let's clarify a couple of things first. Only silence the password request If your issue is only the password prompt, you can silence it. I quote the manual here : -w --no-password Never issue a password prompt. If

PostgreSQL “DESCRIBE TABLE”

心不动则不痛 提交于 2019-11-26 01:48:18
问题 How do you perform the equivalent of Oracle\'s DESCRIBE TABLE in PostgreSQL (using the psql command)? 回答1: Try this (in the psql command-line tool): \d+ tablename See the manual for more info. 回答2: In addition to the PostgreSQL way (\d 'something' or \dt 'table' or \ds 'sequence' and so on) The SQL standard way, as shown here: select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = '<name of table>'; It's supported by many db engines. 回答3: If

Run batch file with psql command without password

↘锁芯ラ 提交于 2019-11-26 01:08:40
问题 I am trying to execute this psql command using a batch script: psql --host=localhost --dbname=<dbname> --port=<Port Number> --username=<dbuser> --file=C:\\PSQL_Script.txt --output=C:\\PSQL_Output.txt The problem is that it\'s asking for the password every time I execute the batch script. How can I password argument through the batch file? 回答1: Keep reading, the best options come last . But let's clarify a couple of things first. Only silence the password request If your issue is only the

In psql, why do some commands have no effect?

五迷三道 提交于 2019-11-25 23:50:48
问题 Sometimes my commands in psql seem to be having no effect. Any idea why? The below is the list of all tables in the database library_development : library_development=> \\d List of relations Schema | Name | Type | Owner --------+-------------------+-------+---------- public | Pavan | table | postgres public | schema_migrations | table | sai (2 rows) After this I dropped the table Pavan using : library_development-> drop table Pavan But the Table isn\'t dropped and its shows as shown : library