Im trying to alter a table ALTER TABLE database.table...
What is the correct notation to access tables in a DB from the base postgres db without having to explicitly connect to that database?
CodePudding user response:
There is no way. You have to connect to the right database.
CodePudding user response:
A DATABASE within MySQL is comparable with a SCHEMA in PostgreSQL and many other brands.
MySQL: ALTER TABLE database.table...
Others: ALTER TABLE schema.table...
From the MySQL manual:
CREATE SCHEMA is a synonym for CREATE DATABASE.
This actually means that a single MySQL server has just a single database. This database can have many schema's and every schema can have many tables.
Within a single database you can jump from one schema to the other schema, no problem. This works for MySQL, PostgreSQL and many others. You can not jump from one database to another database without a new database connection because it's a different instance.
It is that MySQL uses a different name for a schema, it calls this a database. A little confusing.
If you want the same thing in other databases, like PostgreSQL, just use schema's within a single database.