Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Laurenz Albe
On Fri, 2020-08-21 at 18:59 +0200, Thomas Boussekey wrote: > I wrote this BASH script to remove the TOAST table, if it may help anyone: > > [...] > toast_pages="$(psql -U postgres --dbname=${database_name} -At --no-psqlrc > -c "select relpages from pg_class where relname = 'pg_toast_2613';" )"

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Laurenz Albe
On Sat, 2020-08-22 at 10:47 +0900, Michael Paquier wrote: > > Indeed, system tables have no TOAST tables in PostgreSQL, so I wonder > > how your "pg_largeobject" table could have grown one. > > FWIW, src/include/catalog/toasting.h is giving me a list of 28 catalog > tables with a toast relation as

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Michael Paquier
On Fri, Aug 21, 2020 at 03:10:30PM +0200, Laurenz Albe wrote: > Indeed, system tables have no TOAST tables in PostgreSQL, so I wonder > how your "pg_largeobject" table could have grown one. FWIW, src/include/catalog/toasting.h is giving me a list of 28 catalog tables with a toast relation as of HE

Re: pg_dump & RLS

2020-08-21 Thread Tom Lane
=?UTF-8?Q?Eduard_Catal=C3=A0?= writes: > - ¿is posible to export using pg_dump only the rows that satisfy a rls > check? > - Of course, yes, use the --enable-row-security option in pg_dump > - Yes, but my RLS expression relies on a GUC: > CREATE POLICY my_policy ON my_table USING (company_id = >

pg_dump & RLS

2020-08-21 Thread Eduard Català
Hi all, Sorry if this is not the appropriate list, I think so. - ¿is posible to export using pg_dump only the rows that satisfy a rls check? - Of course, yes, use the --enable-row-security option in pg_dump - Yes, but my RLS expression relies on a GUC: CREATE POLICY my_policy ON my_table USING (

Re: pgbouncer bug?

2020-08-21 Thread Achilleas Mantzios
On 21/8/20 7:56 μ.μ., greigwise wrote: Not sure if this is the right place to post this, but if not someone please point me in the right direction. My issue is with pgbouncer 1.14. This does not seem to happen on 1.13. If I do a service pgbouncer restart, then anytime I try to connect to my

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Thomas Boussekey
Le ven. 21 août 2020 à 16:45, Laurenz Albe a écrit : > On Fri, 2020-08-21 at 15:46 +0200, Thomas Boussekey wrote: > > Le ven. 21 août 2020 à 15:10, Laurenz Albe a > écrit : > > > On Fri, 2020-08-21 at 14:00 +0200, Thomas Boussekey wrote: > > > > Working on a PostgreSQL 9.5 to 12 upgrade, I encou

pgbouncer bug?

2020-08-21 Thread greigwise
Not sure if this is the right place to post this, but if not someone please point me in the right direction. My issue is with pgbouncer 1.14. This does not seem to happen on 1.13. If I do a service pgbouncer restart, then anytime I try to connect to my databases via pgbouncer, I get ERROR: no s

Re: Query plan prefers hash join when nested loop is much faster

2020-08-21 Thread Michael Lewis
Your system is preferring sequential scan to using test_result_module_result_id_idx in this case. What type of storage do you use, what type of cache hits do you expect, and what do you have random_page_cost set to? That comes to mind as a significant factor in choosing index scans based on costs.

Query plan prefers hash join when nested loop is much faster

2020-08-21 Thread iulian dragos
Hi, I am trying to understand why the query planner insists on using a hash join, and how to make it choose the better option, which in this case would be a nested loop. I have two tables: // about 200 million rows CREATE TABLE module_result( *id* bigserial PRIMARY KEY, name_id bigint NOT

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Laurenz Albe
On Fri, 2020-08-21 at 15:46 +0200, Thomas Boussekey wrote: > Le ven. 21 août 2020 à 15:10, Laurenz Albe a écrit > : > > On Fri, 2020-08-21 at 14:00 +0200, Thomas Boussekey wrote: > > > Working on a PostgreSQL 9.5 to 12 upgrade, I encounter problems on a > > > PostgreSQL instance when I have > >

Re: BUG? Slave don't reconnect to the master

2020-08-21 Thread Jehan-Guillaume de Rorthais
On Thu, 20 Aug 2020 15:16:10 +0300 Олег Самойлов wrote: [...] > >> Almost works fine, but sometimes, rather rare, I detected that a slave > >> don't reconnect to the new master after a failure. First case is > >> PostgreSQL-STOP, when I `kill` by STOP signal postgres on the master to > >> simulate

Re: Creating many tables gets logical replication stuck

2020-08-21 Thread Achilleas Mantzios
Dear Laurenz thank you for your analysis and report. On 21/8/20 4:00 μ.μ., Laurenz Albe wrote: Reproducer on 12.4: This is identical problem with this report here : https://www.postgresql.org/message-id/6fa054d8-ad14-42a2-8926-5d79c97ecd65%40matrix.gatewaynet.com Yours, Laurenz Albe -- Ach

Re: Fwd: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Tom Lane
Thomas Boussekey writes: > Le ven. 21 août 2020 à 15:10, Laurenz Albe a > écrit : >> The safest way would be to upgrade with pg_dumpall/psql. > The `pg_dumpall` command will also copy the content and the existence of > the `pg_toast_2613` table, isn't it? No. pg_dumpall does not do anything wi

Fwd: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Thomas Boussekey
-- Forwarded message - De : Thomas Boussekey Date: ven. 21 août 2020 à 15:37 Subject: Re: When are largobject records TOASTed into pg_toast_2613? To: Laurenz Albe Le ven. 21 août 2020 à 15:10, Laurenz Albe a écrit : > On Fri, 2020-08-21 at 14:00 +0200, Thomas Boussekey wrote:

Re: is date_part immutable or not?

2020-08-21 Thread Олег Самойлов
> 21 авг. 2020 г., в 16:14, Laurenz Albe написал(а): > Two approaches: > > 1. Use "timestamp without time zone". Yep, I redefined to timestamp without time zone. Thus loose timezone information from source, but happily there is not the daylight savings time shift in my country now. > > 2.

Re: is date_part immutable or not?

2020-08-21 Thread Laurenz Albe
On Fri, 2020-08-21 at 14:57 +0300, Олег Самойлов wrote: > Just create partitioned table for PostgreSQL logs > > CREATE TABLE pglog.pglog ( >log_time timestamp(3) with time zone, > [...] > ) PARTITION BY LIST (date_part('isodow', log_time)); > > ERROR: functions in partition key expression mu

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Laurenz Albe
On Fri, 2020-08-21 at 14:00 +0200, Thomas Boussekey wrote: > Working on a PostgreSQL 9.5 to 12 upgrade, I encounter problems on a > PostgreSQL instance when I have > an existing table `pg_toast_2613` into my application database. > > The upgrade process fails with the following error: > > ``` >

Creating many tables gets logical replication stuck

2020-08-21 Thread Laurenz Albe
Reproducer on 12.4: On the primary: CREATE TABLE repli (id bigint PRIMARY KEY, val text NOT NULL); CREATE PUBLICATION repli_pub FOR TABLE repli; On the standby: CREATE TABLE repli (id bigint PRIMARY KEY, val text NOT NULL); CREATE SUBSCRIPTION repli_sub CONNECTION '...' PUBLICATION repli_pub;

Re: When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Thomas Boussekey
Le ven. 21 août 2020 à 14:00, Thomas Boussekey a écrit : > Hello all, > > Working on a PostgreSQL 9.5 to 12 upgrade, I encounter problems on a > PostgreSQL instance when I have an existing table `pg_toast_2613` into my > application database. > > The upgrade process fails with the following error

Query plan prefers hash join when nested loop is much faster

2020-08-21 Thread iulian dragos
Hi, I am trying to understand why the query planner insists on using a hash join, and how to make it choose the better option, which in this case would be a nested loop. I have two tables: // about 200 million rows CREATE TABLE module_result( *id* bigserial PRIMARY KEY, name_id bigint NOT

Re: is date_part immutable or not?

2020-08-21 Thread Олег Самойлов
My mistake. Schema | pg_catalog Name| date_part Result data type| double precision Argument data types | text, timestamp with time zone Type| func Volatility | stable Parallel| safe Owner | postgres Security

When are largobject records TOASTed into pg_toast_2613?

2020-08-21 Thread Thomas Boussekey
Hello all, Working on a PostgreSQL 9.5 to 12 upgrade, I encounter problems on a PostgreSQL instance when I have an existing table `pg_toast_2613` into my application database. The upgrade process fails with the following error: ``` No match found in new cluster for old relation with OID 16619 in

is date_part immutable or not?

2020-08-21 Thread Олег Самойлов
PostgreSQL 12.4 Just create partitioned table for PostgreSQL logs CREATE TABLE pglog.pglog ( log_time timestamp(3) with time zone, user_name text, database_name text, process_id integer, connection_from text, session_id text, session_line_num bigint, command_tag text, se

Re: > ERROR: syntax error at or near "BYTE"

2020-08-21 Thread Paul Förster
Hi, > On 21. Aug, 2020, at 10:19, postgresdba...@outlook.com wrote: > > CREATE TABLE "A" > ( > "b" DATE, > "c " NUMBER, > " d " VARCHAR2(255 BYTE), > "e "VARCHAR2(255 BYTE)) > > When ı create table then after error why error

Re: Loading Oracle Spatial Data to Postgresql

2020-08-21 Thread Laurenz Albe
On Thu, 2020-08-20 at 14:30 +, Ko, Christina wrote: > I am running into issue using DMS to load oracle spatial data (oracle > 11.2.0.3) to postgresql. > > Oracle table: > > CREATE TABLE Spatial_Tbl > IDNUMBER(38,9), > P_ID NUMBER(38,9), > GEOMETRY MDSYS.SDO_GEOMETRY If th

Re: > ERROR: syntax error at or near "BYTE"

2020-08-21 Thread Magnus Hagander
On Fri, Aug 21, 2020 at 10:33 AM postgresdba...@outlook.com < postgresdba...@outlook.com> wrote: > CREATE TABLE "A" > ( > "b" DATE, > "c " NUMBER, > " d " VARCHAR2(255 BYTE), > "e "VARCHAR2(255 BYTE)) > > When ı create table then

> ERROR: syntax error at or near "BYTE"

2020-08-21 Thread postgresdba...@outlook.com
CREATE TABLE "A" ( "b" DATE, "c " NUMBER, " d " VARCHAR2(255 BYTE), "e "VARCHAR2(255 BYTE)) When ı create table then after error why error in byte please heplp me thanks error:> ERROR: syntax error at or near "BYTE"