Query Tool で、sql ファイルを開き実行するとエラーになります。
エラーメッセージ
ERROR: syntax error at or near "t3463"
LINE 47: t3463 東広島 92513 2001-06-12
^
SQL state: 42601
Character: 1070
SQL ファイル
may0704.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.2 (Ubuntu 15.2-1)
-- Dumped by pg_dump version 15.2 (Ubuntu 15.2-1)
-- Started on 2023-05-07 11:21:18 JST
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 214 (class 1259 OID 20742)
-- Name: cities; Type: TABLE; Schema: public; Owner: scott
--
CREATE TABLE public.cities (
id character varying(10) NOT NULL,
name text,
population integer,
date_mod date
);
ALTER TABLE public.cities OWNER TO scott;
--
-- TOC entry 3339 (class 0 OID 20742)
-- Dependencies: 214
-- Data for Name: cities; Type: TABLE DATA; Schema: public; Owner: scott
--
COPY public.cities (id, name, population, date_mod) FROM stdin;
t3463 東広島 92513 2001-06-12
t3464 呉 93167 2001-09-29
t3465 尾道 95419 2001-03-18
t3466 竹原 82314 2001-02-21
t3467 三次 76152 2001-08-16
t3468 大竹 37541 2001-07-07
t3469 府中 46518 2001-10-09
\.
-- Completed on 2023-05-07 11:21:18 JST
--
-- PostgreSQL database dump complete
--
psql で実行した結果
$ psql -U scott city < may0704.sql
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
COPY 7
sql ファイルの作成方法
pgadmin4 のバックアップで作成しました。
Format を plain にしました。
ファイルは次の場所に出来ました。
ユーザーが test@test.com の場合です。
/var/lib/pgadmin/storage/test_test.com