Re: Rows violating Foreign key constraint exists

2019-11-28 Thread Nandakumar M
Hi, > It could be that somebody disabled the triggers, but that would have to > be a superuser. And I hope that people randomly disabling system triggers > on tables don't have superuser access to your database. It is unlikely that this happened. So I am assuming corruption. But I am able to que

Re: using replace function

2019-11-28 Thread Tom Lane
"David G. Johnston" writes: > On Thursday, November 28, 2019, Rob Sargent wrote: >> I want to replace a string (not a substring) in a field but making sure >> that the string in the full field. > I’d probably do something like: > Select case when a.col = ‘value’ then ‘new value’ else a.col end f

Re: using replace function

2019-11-28 Thread David G. Johnston
On Thursday, November 28, 2019, Rob Sargent wrote: > > > > On Nov 28, 2019, at 1:09 PM, Antonio Silva > wrote: > > > > Hello list > > > > I want to replace a string (not a substring) in a field but making sure > that the string in the full field. > > > > In the example below since 'blue' is not

Re: using replace function

2019-11-28 Thread Rob Sargent
> On Nov 28, 2019, at 1:09 PM, Antonio Silva wrote: > > Hello list > > I want to replace a string (not a substring) in a field but making sure that > the string in the full field. > > In the example below since 'blue' is not the full text in 'blue shark' there > should not have a replaceme

using replace function

2019-11-28 Thread Antonio Silva
Hello list I want to replace a string (not a substring) in a field but making sure that the string in the full field. In the example below since 'blue' is not the full text in 'blue shark' there should not have a replacement. How to say "replace only with 'blue' if it is the full string in the f

Re: status of CURSORs after DISCONNECT

2019-11-28 Thread George Neuner
On Thu, 28 Nov 2019 09:58:50 -0500, Tom Lane wrote: >Matthias Apitz writes: >> When an ESQL/C written process issues a >> EXEC SQL DISCONNECT [connection]; >> do the opened CURSOR(s) still survive? > >No. Cursors are purely session-local objects in Postgres. >I'm a bit surprised to hear it migh

Re: Rows violating Foreign key constraint exists

2019-11-28 Thread Adrian Klaver
On 11/28/19 5:25 AM, Nandakumar M wrote: Hi, I am using PG version 10.5. Saw a table where we have foreign key defined but few thousand rows violate the foreign key constraint. Have you verified that the FK is not in the parent table and is just not some index error/corruption? It might

Re: status of CURSORs after DISCONNECT

2019-11-28 Thread George Neuner
On Thu, 28 Nov 2019 07:27:15 +0100, Matthias Apitz wrote: >When an ESQL/C written process issues a > >EXEC SQL DISCONNECT [connection]; > >do the opened CURSOR(s) still survive? We run into the problem that the >father process issues DISCONNECT before forking children, the forked child >CONNECTs

Re: status of CURSORs after DISCONNECT

2019-11-28 Thread Tom Lane
Matthias Apitz writes: > When an ESQL/C written process issues a > EXEC SQL DISCONNECT [connection]; > do the opened CURSOR(s) still survive? No. Cursors are purely session-local objects in Postgres. I'm a bit surprised to hear it might be different in Sybase. regards, t

Re: Re: Postgres Full Text Search Jsonb Array column does not search for first row

2019-11-28 Thread Laurenz Albe
On Wed, 2019-11-27 at 11:54 +0200, Dmytro Zhluktenko wrote: > explain (analyze, BUFFERS) > SELECT * > FROM "cp"."Repro" x where cp.make_tsvector(x) @@ 'fir:*'::tsquery > > outputs this query plan: > Bitmap Heap Scan on "Repro" x (cost=12.00..16.26 rows=1 width=72) (actual > time=0.007..0.007 row

Re: Rows violating Foreign key constraint exists

2019-11-28 Thread Laurenz Albe
On Thu, 2019-11-28 at 18:55 +0530, Nandakumar M wrote: > I am using PG version 10.5. > > Saw a table where we have foreign key defined but few thousand rows > violate the foreign key constraint. > > I understand that one possibility of this happening is if we had > manually disabled the triggers

Rows violating Foreign key constraint exists

2019-11-28 Thread Nandakumar M
Hi, I am using PG version 10.5. Saw a table where we have foreign key defined but few thousand rows violate the foreign key constraint. I understand that one possibility of this happening is if we had manually disabled the triggers that do FK integrity checks and re enabled them afterwards. Is t

Re: Range contains element filter not using index of the element column

2019-11-28 Thread Alban Hertroys
> On 27 Nov 2019, at 10:32, Lauri Kajan wrote: > > Hi all, > I'm wondering if there are anything to do to utilize a index when doing a > range contains element query. I have tested this with 9.6 and 12.0. > > I have a table with a timestamp column that has a btree index. > I would like to do