Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Jian He
you may be interested > https://dba.stackexchange.com/q/166762/238839 On Wed, Jan 26, 2022 at 3:03 AM Ivan Panchenko wrote: > > On 26.01.2022 00:21, benj@laposte.net wrote: > > Le 25/01/2022 à 18:10, Shaozhong SHI a écrit : > >> There is a short of a function in the standard Postgres to do t

Re: Undetected Deadlock

2022-01-25 Thread Alvaro Herrera
On 2022-Jan-25, Michael Harris wrote: > We've recently updated our application to PG 14.1, and in the test instance we > have started to see some alarming undetected deadlocks. This is indeed suspicious / worrisome / curious. What version were you using previously? I reformatted the result sets

Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Ivan Panchenko
On 26.01.2022 00:21, benj@laposte.net wrote: Le 25/01/2022 à 18:10, Shaozhong SHI a écrit : There is a short of a function in the standard Postgres to do the following: It is easy to count the number of occurrence of words, but it is rather difficult to count the number of occurrence of

Re: Counting the number of repeated phrases in a column

2022-01-25 Thread benj . dev
Le 25/01/2022 à 18:10, Shaozhong SHI a écrit : There is a short of a function in the standard Postgres to do the following: It is easy to count the number of occurrence of words, but it is rather difficult to count the number of occurrence of phrases. For instance: A cell of value:  'Hello W

NIST 800-53v4 scanning?

2022-01-25 Thread Ben Chobot
Hello pgsql-general, I've been tasked with scanning our Ubuntu-hosted databases for NIST 800-53v4 compliance. I'm finding a paucity of tools out there that will do this. I found a few that might work, when pointed at Postgres 9 on RHEL, but not much else. Is this a problem anybody else has t

Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Laura Smith
‐‐‐ Original Message ‐‐‐ On Tuesday, January 25th, 2022 at 17:10, Shaozhong SHI wrote: > 'The City of London, London' also has no occurrences of any repeated phrase. Not sure the City would be particularly happy with that attribution. ;-) Its it sits on its own. Its own local authori

Re: Counting the number of repeated phrases in a column

2022-01-25 Thread David G. Johnston
On Tue, Jan 25, 2022 at 10:10 AM Shaozhong SHI wrote: > Anyone has got such a function to check out the number of occurrence of > any repeated phrases? > Not I. But I wouldn't be surprised that such an algorithm exists and that it has been implemented - in a language other than SQL or pl/pgsql.

Aw: Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Karsten Hilbert
> How about split up the value into individual words and keep their orders? > add words up to form individual phrase and ensure that each phrase only > consists unique/distinct words > count repeated phrases afterward >   > How about this? Sure, if that serves your purpose ? So far, we (I?) can'

Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Shaozhong SHI
How about split up the value into individual words and keep their orders? add words up to form individual phrase and ensure that each phrase only consists unique/distinct words count repeated phrases afterward How about this? Regards, David On Tue, 25 Jan 2022 at 17:22, Karsten Hilbert wrote:

Aw: Counting the number of repeated phrases in a column

2022-01-25 Thread Karsten Hilbert
> There is a short of a function in the standard Postgres to do the following: >   > it is easy to count the number of occurrence of words, but it is rather > difficult to count the number of occurrence of phrases. >   > For instance: >   > A cell of value:  'Hello World' means 1 occurrence a phra

Counting the number of repeated phrases in a column

2022-01-25 Thread Shaozhong SHI
There is a short of a function in the standard Postgres to do the following: It is easy to count the number of occurrence of words, but it is rather difficult to count the number of occurrence of phrases. For instance: A cell of value: 'Hello World' means 1 occurrence a phrase. A cell of value

Re: Robust ways for checking allowed values in a column

2022-01-25 Thread Rob Sargent
On 1/25/22 09:35, Shaozhong SHI wrote: How about adding null as an alteration. Would this be robust? Regards, David On Tue, 25 Jan 2022 at 14:25, David G. Johnston wrote: On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI wrote:  select form from mytable  where form ~

Re: Robust ways for checking allowed values in a column

2022-01-25 Thread Shaozhong SHI
How about adding null as an alteration. Would this be robust? Regards, David On Tue, 25 Jan 2022 at 14:25, David G. Johnston wrote: > On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI > wrote: > >> select form from mytable where form ~ >> '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lock

Re: tstzrange on large table gives poor estimate of expected rows

2022-01-25 Thread Tom Dearman
Thanks for your help. It is true we could get rid of it but we still want to use the functional index on the date range as we understand it is supposed to be a better look up - we also have other date range look ups on tables that seem to be degrading. I have found a solution to the problem. The

Re: GIN index

2022-01-25 Thread Julien Rouhaud
Hi, On Tue, Jan 25, 2022 at 02:42:14AM +, huangning...@yahoo.com wrote: > Hi:I created a new variable-length data type, and now I want to create a GIN > index for it. According to the rules of GIN index, I created three functions: > extractValue, extractQuery, and compare. I made sure that the

Re: Robust ways for checking allowed values in a column

2022-01-25 Thread Ray O'Donnell
On 25/01/2022 13:55, Shaozhong SHI wrote: I tried the following: select form from mytable where form ~ '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$' I used ^ and $ to ensure checking of allowed values. However, '

Re: Robust ways for checking allowed values in a column

2022-01-25 Thread David G. Johnston
On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI wrote: > select form from mytable where form ~ > '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$' > You do not need to repeat the boundary metacharacters on each branch. Yo

Re: Robust ways for checking allowed values in a column

2022-01-25 Thread Guillaume Lelarge
Le mar. 25 janv. 2022 à 14:56, Shaozhong SHI a écrit : > I tried the following: > > select form from mytable where form ~ > '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$' > > I used ^ and $ to ensure checking of allowe

Robust ways for checking allowed values in a column

2022-01-25 Thread Shaozhong SHI
I tried the following: select form from mytable where form ~ '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$' I used ^ and $ to ensure checking of allowed values. However, 'Backyard' was selected. Why is that? Regards

GIN index

2022-01-25 Thread huangning...@yahoo.com
Hi:I created a new variable-length data type, and now I want to create a GIN index for it. According to the rules of GIN index, I created three functions: extractValue, extractQuery, and compare. I made sure that the return value of the first two functions is the address of the array, but when u