here is sql code of file that i want to convert into postgresql database

CREATE TABLE banks (
        name character varying(49),
        id bigint NOT NULL
    );

--
-- Name: branches; Type: TABLE; Schema: public; Owner: siva; Tablespace: 
--

CREATE TABLE branches (
    ifsc character varying(11) NOT NULL,
    bank_id bigint,
    branch character varying(74),
    address character varying(195),
    city character varying(50),
    district character varying(50),
    state character varying(26)
);


--
-- Name: bank_branches; Type: VIEW; Schema: public; Owner: siva
--

CREATE VIEW bank_branches AS
 SELECT branches.ifsc,
    branches.bank_id,
    branches.branch,
    branches.address,
    branches.city,
    branches.district,
    branches.state,
    banks.name AS bank_name
   FROM (branches
     JOIN banks ON ((branches.bank_id = banks.id)));

then there is 120k lines of input by using stdin

COPY banks (name, id) FROM stdin;
COPY branches (ifsc, bank_id, branch, address, city, district, state) FROM stdin;

I use django3.2, psycopg2.8, postgrsql 13, windows10

1

There are 1 best solutions below

0
On BEST ANSWER
ERROR: character with byte sequence 0x90 in encoding "WIN1252" has no equivalent in encoding "UTF8" 

for this error I converted file into ANSI and removed all ANSI characters which are not visible in UTF8 in notepad.

then run following command from psql shell

psql -h localhost -d databasename -U username -f "c://path_to_file.sql"