In psql, why do some commands have no effect?

前端 未结 2 1081
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 06:07

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

2条回答
  •  遇见更好的自我
    2020-11-22 06:51

    I just encountered something similar, but the cause was different.

    I was trying to use the dropdb command and what I was seeing was like my command having no effect (change of prompt means my command is in the buffer, but that's not the issue here):

    postgres=# dropdb databasename
    postgres-#
    

    Commands like dropdb should be entered OUTSIDE psql. What i had been doing was:

    $ psql postgres
    postgres=# dropdb databasename
    

    Notice the first command is in Bash and fires psql, and the second is sent within psql.

    The correct way is to send the command directly in bash (the console):

    $ dropdb databasename
    

    Hope this helps a few people.

提交回复
热议问题