Re: Schema Names
От | Tom Lane |
---|---|
Тема | Re: Schema Names |
Дата | |
Msg-id | 14368.1154148527@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Schema Names ("Derrick Betts" <derrick@blueaxis.com>) |
Список | pgsql-novice |
"Derrick Betts" <derrick@blueaxis.com> writes: > However, if I create a new schema, it would seem that the only way to = > access a table within the new schema is to pre-pend the table name with = > the schema name: > CREATE SCHEMA new_schema; > CREATE TABLE new_table (column_name varchar); > SET search_path TO new_schema; > SELECT column_name FROM new_table; This returns an error saying = > there is no such table as new_table. That's because you created new_table in the public schema. I think you are confusing CREATE SCHEMA new_schema; CREATE TABLE new_table (column_name varchar); (two independent commands, and the second one creates new_table in whatever schema is current according to search_path) with CREATE SCHEMA new_schema CREATE TABLE new_table (column_name varchar); which per SQL spec makes new_schema and then creates new_table within it. That semicolon makes a lot of difference... regards, tom lane
В списке pgsql-novice по дате отправления: