「Postgres」の版間の差分

提供: wikipokpok
移動先: 案内検索
(ページの作成:「{{PAGENAME}} mac 10.15.4 brew update brew install postgresql psql --version psql (PostgreSQL) 12.3 initdb /usr/local/var/postgres -E utf8...」)
 
 
(同じ利用者による、間の2版が非表示)
1行目: 1行目:
 
[[category:memo|{{PAGENAME}}]]
 
[[category:memo|{{PAGENAME}}]]
 +
== インストール ==
 
mac 10.15.4
 
mac 10.15.4
 
  brew update
 
  brew update
25行目: 26行目:
  
 
  createuser -d -r ''username''
 
  createuser -d -r ''username''
 +
 +
psql -d tepnote_development
 +
 +
tepnote_development=# \d
 +
 +
pg_restore -c -d tepnote_development shrieking_dump/latest.dump
 +
 +
== 参考sql ==
 +
シーケンス初期化 スタート番号
 +
select setval ('users_id_seq', 1, false);
 +
 +
select setval ('users_id_seq', 10);

2022年2月23日 (水) 13:43時点における最新版

インストール[編集]

mac 10.15.4

brew update
brew install postgresql
psql --version
    psql (PostgreSQL) 12.3
initdb /usr/local/var/postgres -E utf8
   The files belonging to this database system will be owned by user "**".
   This user must also own the server process.
   he database cluster will be initialized with locale "ja_JP.UTF-8".
   initdb: could not find suitable text search configuration for locale "ja_JP.UTF-8"
   The default text search configuration will be set to "simple".
   Data page checksums are disabled.
   initdb: error: directory "/usr/local/var/postgres" exists but is not empty
   If you want to create a new database system, either remove or empty
   the directory "/usr/local/var/postgres" or run initdb
   with an argument other than "/usr/local/var/postgres".
brew services start postgresql
psql -l
createuser -d -r username
psql -d tepnote_development
tepnote_development=# \d
pg_restore -c -d tepnote_development shrieking_dump/latest.dump

参考sql[編集]

シーケンス初期化 スタート番号

select setval ('users_id_seq', 1, false);
select setval ('users_id_seq', 10);