USE "schema_name" in PostgreSQL, PostgreSQL Schema

Source: Internet
Author: User

USE "schema_name" in PostgreSQL, PostgreSQL Schema

Http://timmurphy.org/tag/mysql/

Http://timmurphy.org/2009/11/17/use-schema_name-in-postgresql/

==========================================

For those moving from MySQL to PostgreSQL, there are a few differences which you will need to get used. one of these differences is the USE command, used to select the schema to select tables, views, etc from.

PostgreSQL does not have the USE command. Instead, you can use:

SET search_path TO [schema_name]

For example, if we have a schemaMySchemaIn which we are queryingPersonTable, insteadSELECT * FROM mySchema.person, We can simply typeSET search_path TO mySchemaAnd useSELECT * FROM personFor all subsequent queries.MySchemaWill remain the default schema until the next SET command is issued, or the connection is closed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.