Question on creating keys on partitioned tables

2023-03-30 Thread Siddharth Jain
Hi All, I have this question. Say I create a partitioned table on column X. Option 1: I add a primary key on (X,Y). Y is another column. Even though Y is a globally unique PK (global meaning it is unique across partitions, not just in one partition), Postgres does not allow me to create a PK on

Re: recovery long after startup

2023-03-30 Thread Tom Lane
=?utf-8?Q?R=C3=A9beli-Szab=C3=B3_Tam=C3=A1s?= writes: > I have noticed that a PostgreSQL 13 server went into recovery mode for 2 > seconds during normal operation, not at startup, preventing users from > connecting. The most obvious explanation is that a backend (or other postmaster child process

recovery long after startup

2023-03-30 Thread Rébeli-Szabó Tamás
Hello All, I have noticed that a PostgreSQL 13 server went into recovery mode for 2 seconds during normal operation, not at startup, preventing users from connecting.  Here is a log excerpt: 2023-03-29 10:45:46.973 CEST [114782] [unknown]@[unknown] LOG:  connection received: host=10.150.52.16

Re: Do BRIN indexes support MIN/MAX?

2023-03-30 Thread Andrey Klochkov
Vladimir, Here's the use case description. We have some large tables that are effectively append-only logs with some stats on our systems. The table I was experimenting with recently contains 6 months of data. It has a timestamp column that tells when the stats in the row were collected. The system

Re: Multilang text search. Is this correct?

2023-03-30 Thread Tom Lane
Florents Tselai writes: > In my table (mix of text and jsonb columns ) I have text in multiple > languages. > I’d like search in all the possible regconfigs, so I’ve come up with the > following recipe: > CREATE FUNCTION to_tsvector_multilang(text) RETURNS tsvector AS > $$ > SELECT to_tsvector

Re: Using CTID system column as a "temporary" primary key

2023-03-30 Thread Peter J. Holzer
On 2023-03-29 12:15:09 -0700, Adrian Klaver wrote: > On 3/29/23 09:43, Peter J. Holzer wrote: > > On 2023-03-29 07:59:54 -0700, Adrian Klaver wrote: > > > On 3/29/23 07:19, Sebastien Flaesch wrote: > > > > INSERT statements must not use the serial column, so you have to > > > > list all columns of

Re: libpq: COPY FROM STDIN BINARY of arrays

2023-03-30 Thread Tom Lane
Dominique Devienne writes: > Does the wire-format of arrays differ between binary-binds and binary-copy? No. > Any pointers to what I could look at, to resolve this? doc? code? example? array_send and array_recv might help you. Keep in mind that maybe the problem is with array element(s) not t

libpq: COPY FROM STDIN BINARY of arrays

2023-03-30 Thread Dominique Devienne
Hi, I already use arrays fine (e.g. text[]) in BINARY mode binds (with prepared statement or not). I already use COPY FROM STDIN BINARY fine, with scalar values. But for the 1st time, I'm combining COPY with arrays, and it is NOT fine yet :( #08P01: ERROR: insufficient data left in message CONT

Re: Using CTID system column as a "temporary" primary key

2023-03-30 Thread Laurenz Albe
On Thu, 2023-03-30 at 14:32 +0200, Dominique Devienne wrote: > I fail to see that myself, sorry. You can bind NULL, you can bind values, so > why > wouldn't you be able to bind DEFAULT too? I see that more as a failing to the > binding API myself :) That doesn't work because DEFAULT is not a valu

Re: Using CTID system column as a "temporary" primary key

2023-03-30 Thread Dominique Devienne
On Thu, Mar 30, 2023 at 11:42 AM Francisco Olarte wrote: > On Thu, 30 Mar 2023 at 10:01, Dominique Devienne > wrote: > > BTW, default and 0 are not the same thing. You cannot bind "default" in > place of > > an integer-valued prepared-statement placeholder, in a binary mode > insert. So it is >

Re: Get dead tuples data

2023-03-30 Thread David Rowley
On Thu, 30 Mar 2023 at 22:21, 任重 wrote: > Here is anyway to Get dead tuples data from table when I had disable > autovacuum? > I need whole row data https://www.postgresql.org/docs/current/pageinspect.html#id-1.11.7.34.5 David

Re: Using CTID system column as a "temporary" primary key

2023-03-30 Thread Francisco Olarte
On Thu, 30 Mar 2023 at 10:01, Dominique Devienne wrote: >> 2) 0 can be a valid sequence value: > Of course. Yet, as above, if that is opt-in as specified in the `create > table` DDL somehow, then why not? > BTW, default and 0 are not the same thing. You cannot bind "default" in place > of > an i

Get dead tuples data

2023-03-30 Thread 任重
hello here is my trouble. Here is anyway to Get dead tuples data from table when I had disable autovacuum? I need whole row data thanks

Multilang text search. Is this correct?

2023-03-30 Thread Florents Tselai
In my table (mix of text and jsonb columns ) I have text in multiple languages. I’d like search in all the possible regconfigs, so I’ve come up with the following recipe: CREATE FUNCTION to_tsvector_multilang(text) RETURNS tsvector AS $$ SELECT to_tsvector('english', $1) || to_tsvector('g

Re: Using CTID system column as a "temporary" primary key

2023-03-30 Thread Dominique Devienne
On Wed, Mar 29, 2023 at 9:23 PM Adrian Klaver wrote: > On 3/29/23 12:11, Sebastien Flaesch wrote: > > Oh the use of default keyword is new to me, thanks for that. > > > > But to make PostgreSQL more Informix-compatible, > > zero should have been considered as well. Perhaps. > 1) Why? Down the