LoginSignup
0
1

More than 5 years have passed since last update.

PostgreSQL:全てのカラム名を小文字に

Last updated at Posted at 2017-02-24

re:Dash(PostgreSQL)で、あるはずの列を参照しようとして"column (カラム名) does not exist"というエラーが出た対策なのは内緒です

select 'ALTER TABLE '||'"'||table_name||'"'||' RENAME COLUMN '||'"'||column_name||'"'||' TO ' || lower(column_name)||';' 
from information_schema.columns 
where table_schema = 'public' and lower(column_name) != column_name;

psqlで上記を実行してやり、生成されたクエリをコピペして実行しました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1