Khắc phục lỗi column c.relhasoids does not exist Postgresql

Trong khi bạn thực hiện câu lệnh \d+ table_name để xem chi tiết thông tin description của bảng thì xuất hiện lỗi này:

ERROR: column c.relhasoids does not exist

LINE 1: …, c.relhasindex, c.relhasrules, c.relhastriggers, c.relhasoi…

word image 1933 1

Nguyên nhân: Postgresql chưa được cấu hình PATH

[root@localhost pgsql]# cat .bash_profile

[ -f /etc/profile ] && source /etc/profile

PGDATA=/var/lib/pgsql/15/data

export PGDATA

# If you want to customize your settings,

# Use the file below. This is not overridden

# by the RPMS.

[ -f /var/lib/pgsql/.pgsql_profile ] && source /var/lib/pgsql/.pgsql_profile

Khắc phục: Thêm biến môi trường PATH vào file .bash_profile trong thư mục cài đặt của postgresql

Thông thường khi cài đặt xong postgresql sẽ tạo cho chúng ta 1 user có tên là postgres và thư mục home được lưu trong đường dẫn sau: /var/lib/pgsql/

Để biết thư mục home của postgresql bạn xem trong file passwd

vi /etc/passwd

tcpdump:x:72:72::/:/sbin/nologin

oprofile:x:16:16:Special user account to be used by OProfile:/var/lib/oprofile:/sbin/nologin

delete:x:1000:1000:delete:/home/delete:/bin/bash

vboxadd:x:382:1::/var/run/vboxadd:/bin/false

postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash

Trong đường dẫn home này sẽ có 1 file ẩn là .bash_profile => chúng ta tiến hành sửa nó:

cd /var/lib/pgsql/

ls -lha

word image 1933 2

vi /var/lib/pgsql/.bash_profile

Thêm dòng này vào dưới:

export PATH=”/usr/pgsql-15/bin:$PATH”

## trong đó 15 là tên phiên bản bạn đang sử dụng => thay bằng phiên bản postgres bạn đang có, sau đó lưu lại.

Chạy file bash để apply ngay biến môi trường PATH (lưu ý là 2 dấu chấm .):

. .bash_profile

Kiểm tra kết quả:

word image 1933 3

Như vậy là đã hết lỗi, kết quả hiển thị là thông tin chi tiết của bảng.

 

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest

0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận