티스토리 뷰
postgresql schema 생성 및 조회설정.
step1. schema 생성
스키마 생성
CREATE SCHEMA myschema;
schema내 table 접근시
schema.table
다른 사용자가 소유한 스키마를 생성할 경우에는
CREATE SCHEMA schemaname AUTHORIZATION username;
step2. table 생성
CREATE TABLE products ( ... );
OR ( Database의 Default Schema가 Public이다.)
CREATE TABLE public.products ( ... );
step3. 조회 schema 보기
기본적으로 조회되는 스키마에대한 순서와 조회될 스키마를 추가 할 수 있다.
조회 후 test 스키마를 조회 경로에 추가한다.
$ sudo -u postgres psql -Upostgres -W test
test=# show search_path;
search_path
----------------
"$user",public
(1 row)
test=# create schema test;
CREATE SCHEMA
test=# ALTER USER postgres SET search_path = test,public;
test=# show search_path;
search_path
-------------
test, public
(1 row)
위와 같이 test schema를 우선적으로 지정했다면 (test, public)
조회시 public이 우선조회되는게 아니라 test schema가 우선순위로 지정되어 먼저 조회의 대상이 된다.
참고 URL : http://www.postgresql.org/docs/8.1/static/ddl-schemas.html
.by rockesa
'Developer' 카테고리의 다른 글
[PKCS] PKCS#12 인증서, 개인키 파일 분리하기 (0) | 2013.06.28 |
---|---|
[nodejs] PostgreSQL prepared statement 적용. (0) | 2013.06.26 |
[node.js] mysql connection pool 관리 (0) | 2013.05.29 |
[node.js] mysql 연동 (0) | 2013.05.28 |
[qmail] spam black list, white list 등록 (0) | 2013.05.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 해외여행
- k8s
- 영작
- redis
- NGINX
- ubuntu
- 여행
- 비지니스 영어
- Python
- 가정법
- 비교구문
- PostgreSQL
- Python Django
- 다낭
- nodejs
- maven
- memcached
- it
- mongoDB
- 도덕경
- 영문법
- 베트남
- AWS
- Business English
- JBOSS
- hadoop
- 스페인 여행
- hdfs
- 조동사
- 대명사 구문
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함