Inserting rpt content from a file into a table column in json format.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone,

I have a 5gb rpt file.
Rpt file content is as follows:


(base) skoc@skoc ~ % head -5 '/Users/skoc/postgresql/lx/lxRo.rpt' 
lxOid|lxFlags|lxType|lxFromLat|lxFromId|lxToLat|lxToId|lxCrDate|lxRelRul|lxModDate|lxOwner|lxAltOwn1|lxAltOwn2|lxTenant|lxDOV|lxIOV|lxToType
-2147483508|67108864|-542076010|341897887|-40640797|341897887|-40639830|2020-01-24 11:14:52.000|1|2020-01-24 11:14:52.000|-1062416028|-655292577|-1283415274|1|1|1|-2099227551
-2147483247|67108864|-366961227|341897887|-1257644257|341897887|1179980124|2023-04-26 07:43:53.000|1|2023-04-26 07:43:53.000|-1536708294|-655292577|-2119128014|1|-1071039821|-1071043321|708897621
-2147483213|67108864|1076431157|341897887|1128100732|341897887|1128103344|2021-02-05 13:48:55.000|1|2021-02-05 13:48:55.000|-1400837562|-655292577|54575254|1|1|1|-1487879320
-2147482748|67108864|-1075776416|341897887|-215312115|341897887|-215311217|2022-01-24 07:31:56.000|1|2022-01-24 07:31:56.000|1282737577|-655292577|54575254|1|1|1|-60774595

Delimiters is “|”
Current posttgresql version:
PostgreSQL 16.2 on x86_64-apple-darwin20.6.0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit
plm=# show work_mem;
 work_mem 
----------
 16MB
(1 row)


I created a table with the following command.

CREATE TABLE IF NOT EXISTS public.lxbo
(
    c1 serial NOT NULL,
    c2 jsonb NOT NULL,
    CONSTRAINT lxbo_pkey PRIMARY KEY (c1)
)

The process I want to do:
insert the data whose content is specified above into column c2 in jsonb format.

1-How should the rpt file content be converted to jsonb format?
2-What is the way to import the relevant jsonb file into the table I specified?
3-Do I need to update the work_mem value and/or any other value?

Thanks 
Salim KOÇ


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux