postgresql-11

Importing a JSON file into Postgresql 11 on Windows 10

佐手、 提交于 2019-12-11 03:58:38
问题 I have a JSON file, C:\sensors\201802091904.json . This data file is on the same local drive as the PostgreSQL installation. Here is a sample of the JSON: [ {"Data": " ** collection of property-value pairs ** }} ", "EventId": "", "Timestamp": ""}, {"Data": " ** collection of property-value pairs ** }} ", "EventId": "", "Timestamp": ""}, {"Data": " ** collection of property-value pairs ** }} ", "EventId": "", "Timestamp": ""} ] The Data property value is a JSON object and contains an

How to change/set the block size in Postgres? Is there any file to make the configuration?

馋奶兔 提交于 2019-12-11 01:56:59
问题 I'm looking for the BLOCKSIZE configuration in postgres. I want to know is there a way to change/set the value? 回答1: In PostgreSQL v11, you can do that when you create the cluster: initdb --wal-segsize=<size in MB> [other options] In older versions of PostgreSQL, you have to recompile after configuring with ./configure --with-wal-segsize=<size in MB> 回答2: This is no runtime configuration. https://www.postgresql.org/docs/current/storage-page-layout.html Every table and index is stored as an

PostgreSQL does not use proper partition on UPDATE statement

限于喜欢 提交于 2019-12-10 12:21:17
问题 Executing a regular UPDATE statement on a partitioned table seems to be worst than doing it in a regular one. Setup CREATE TABLE users ( id VARCHAR(10) NOT NULL, name VARCHAR(10) NOT NULL ) PARTITION BY HASH (id); ALTER TABLE users ADD PRIMARY KEY (id); CREATE TABLE users_p0 PARTITION OF users FOR VALUES WITH (MODULUS 3, REMAINDER 0); CREATE TABLE users_p1 PARTITION OF users FOR VALUES WITH (MODULUS 3, REMAINDER 1); CREATE TABLE users_p2 PARTITION OF users FOR VALUES WITH (MODULUS 3,

JPA Model Class for field TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP in Postgres?

筅森魡賤 提交于 2019-12-08 13:37:09
问题 I've below Table in Postgres and using Java 8 and Postgres-11 with Spring Boot 2.1.6.RELEASE . I already went through the link: How to map timestamp column to JPA type? and Hibernate creates column without name when using "default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP", but I really wanted to use Java 8 Date API and not Java 7. CREATE TABLE note( note_id serial PRIMARY KEY, message varchar(255) NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); I've created

PostgresSQL / pgAdmin4 / dump server version mismatch

99封情书 提交于 2019-12-07 06:40:28
问题 I tried to make a backup with Postgres 11.1 in pgAdmin4, but it failed. pgadmin displayed a window with Status: Failed (exit code: 1). pg_dump:server version: 11.1; pg_dump: 10.5 pg_dump: aborting because of server mismatch I don't really understand it. Does pgadmin4 not know that I am using 11.1 and not 10.5? PROBLEM SOLVED - IN MY CASE. Go to pgadmin < Preferences < Path < Binary Path The PostgreSQL Binary Path was set automatically to $DIR/../runtime I changed the Path to my installed

PostgresSQL / pgAdmin4 / dump server version mismatch

社会主义新天地 提交于 2019-12-05 08:48:48
I tried to make a backup with Postgres 11.1 in pgAdmin4, but it failed. pgadmin displayed a window with Status: Failed (exit code: 1). pg_dump:server version: 11.1; pg_dump: 10.5 pg_dump: aborting because of server mismatch I don't really understand it. Does pgadmin4 not know that I am using 11.1 and not 10.5? PROBLEM SOLVED - IN MY CASE. Go to pgadmin < Preferences < Path < Binary Path The PostgreSQL Binary Path was set automatically to $DIR/../runtime I changed the Path to my installed PostgreSQL Version C:\Program Files\PostgreSQL\11\bin Your pgAdmin is using PostgresSQL client v10, but

PostgreSQL 11 - Procedures

亡梦爱人 提交于 2019-12-04 04:15:26
问题 With the latest update of PostgreSQL supporting procedures. The official blog, quoted that "As opposed to functions, procedures are not required to return a value." (https://blog.2ndquadrant.com/postgresql-11-server-side-procedures-part-1/) So my question is, is there actually any way for me to return error code or response in a procedure? (Procedures is rather new in Postgres thus there were very little resources online.) Here is an example of what I meant by returning these "error codes"

Postgres 11 Stored Procedure not returning results

谁都会走 提交于 2019-12-02 08:35:23
问题 In Postgres 11, are stored procedures not intended to return result sets? Because when we run the following, it says it ran successfully but no results are returned. CREATE OR REPLACE PROCEDURE test() LANGUAGE sql AS $$ SELECT * from aTable; $$; call test(); 回答1: Postgresql procedures can return at most a single value: CREATE PROCEDURE test (INOUT x int) LANGUAGE sql AS $$ SELECT x; $$; # call test (1); x --- 1 (1 row) Postgresql functions are much more flexible: create or replace function

Postgres 11 Stored Procedure not returning results

ε祈祈猫儿з 提交于 2019-12-02 04:33:44
In Postgres 11, are stored procedures not intended to return result sets? Because when we run the following, it says it ran successfully but no results are returned. CREATE OR REPLACE PROCEDURE test() LANGUAGE sql AS $$ SELECT * from aTable; $$; call test(); Postgresql procedures can return at most a single value: CREATE PROCEDURE test (INOUT x int) LANGUAGE sql AS $$ SELECT x; $$; # call test (1); x --- 1 (1 row) Postgresql functions are much more flexible: create or replace function test() RETURNS setof atable language sql as $$ select * from atable; $$; The advantage of procedures is that

Attribute notation for function call gives error

与世无争的帅哥 提交于 2019-12-02 03:06:44
问题 Attribute notation function call gives error when current schema is different from one of function. I have created a function CREATE FUNCTION pub.FullName(pub.reps) RETURNS text AS $func$ select ($1.fname || ' ' || $1.lname) $func$ LANGUAGE SQL; I am trying to call the function with attribute notation as described in docs): select r.fullname from pub.reps r; But get an error message: ERROR: column "fullname" does not exist Query with functional notation works fine: select pub.fullname(r.*)