2020年06月24日

CentOS 8 PostgreSQL12 dnf

Linux downloads (Red Hat family) 

https://www.postgresql.org/download/linux/redhat/





# Install the repository RPM:
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable the built-in PostgreSQL module:
dnf -qy module disable postgresql

# Install PostgreSQL:
dnf -y install postgresql12-server

# Optionally initialize the database and enable automatic start:
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12

 su postgres
 psql
 \l
 alter role postgres with password 'dbPasswd123';
 create database testdb1;
 \q

firewall-cmd --add-port=5432/tcp --zone=public --permanent
firewall-cmd --reload
systemctl restart postgresql-12

posted by a23 at 15:44| Comment(0) | PostgreSQL

2020年06月12日

文字列を分割 split する方法






SELECT mix_key,
SPLIT_PART(mix_key,'_',1) As F1,
SPLIT_PART(mix_key,'_',2) As F2,
SPLIT_PART(mix_key,'T_',1) As F3
FROM public.sttm_close_1
limit 10

SELECT mix_key,
SPLIT_PART(mix_key,'_',1) As F1,
SPLIT_PART(mix_key,'_',2) As F2,
SPLIT_PART(mix_key,'_',3) As F3,
SPLIT_PART(mix_key,'_',4) As F4
FROM public.sttm_close_1
limit 10

posted by a23 at 16:55| Comment(0) | PostgreSQL

2020年06月06日

utc jst 変換

SELECT datetimestamp_field,(datetimestamp_field + time '09:00' ) As datetimestamp_
FROM public.z_uid001_2
limit 100

posted by a23 at 08:41| Comment(0) | PostgreSQL