실행을 할 때마다 아래와 같은 에러 메세지가 발생했다.
application.properties 의 설정은 다음과 같았다.
spring.jpa.hibernate.ddl-auto=update
2025-04-06T23:16:30.934+09:00 WARN 27868 --- [ReadingLogBackend] [ main] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL "
alter table if exists user
alter column user_uuid set data type varchar(255)" via JDBC [ERROR: syntax error at or near "user"
Position: 28]
찍히는 쿼리문을 콘솔에서 실행해보니, 아래와 같은 에러가 발생했다.
alter table if exists user
alter column user_uuid set data type varchar(255)

혹시나 해서 user 에 따옴표를 붙였는데, 정상적으로 실행되었다.
alter table if exists "user"
alter column user_uuid set data type varchar(255)
Table 의 DDL 을 확인해보니, "user" 테이블로 이름이 명명되어 있었다.

create table public."user"
(
user_id integer not null
constraint user_pk
primary key,
user_uuid varchar(255) not null,
nickname varchar(20) not null,
user_email varchar(20) not null,
ins_date timestamp not null,
upd_date timestamp
);
comment on table public."user" is '회원정보';
comment on column public."user".user_id is '사용자 자동ID';
comment on column public."user".user_uuid is '사용자 UUID';
comment on column public."user".nickname is '사용자 닉네임';
comment on column public."user".user_email is '사용자 EMAIL';
comment on column public."user".ins_date is '계정 생성일';
comment on column public."user".upd_date is '계정 수정일';
alter table public."user"
owner to readinglog;
PostgreSQL에서 user 은 예약어이기 때문에, 자동으로 변환된 것이다 !!
실제로 user 테이블을 조회하면 아래와 같이 나온다.

앞으로는 예약어인지 아닌지 신경써서 테이블을 생성할 것. Postgresql 은 이름 명명하는 부분에서 어려움이 있는 DB 인 것 같다. 테이블 명은 users 로 변경해주었다.
다른 PostgreSQL 오류
https://skylarcoding.tistory.com/213#google_vignette
[PostgreSql] 테이블 명 대소문자 인식 불가 문제
sql 테이블명을 tableName 이런식으로 작성했는데, 콘솔에서 쿼리문을 작성할때 " " 따옴표를 붙여야만 인식이 되는 현상이 발생했다. select * from "testTable" // 인식 가능select * from testTable // 인식 불가
skylarcoding.tistory.com