Re: FOR integer loop bug?

2022-04-08 Thread Adrian Klaver
On 4/8/22 11:23, Ron wrote: On 4/8/22 13:07, Adrian Klaver wrote: Hmm, I'm going to have to think on this. The only thinking is: "That's a bug waiting to happen!" That was my first inclination. From here: https://www.postgresql.org/docs/current/plpgsql-control-structures.html#PLPGSQL-CO

Re: FOR integer loop bug?

2022-04-08 Thread Ron
On 4/8/22 13:07, Adrian Klaver wrote: On 4/8/22 10:58 AM, Pavel Stehule wrote: pá 8. 4. 2022 v 19:56 odesílatel Adrian Klaver Alright so 1...10 is taken as 1::integer .. 0.10::integer CAST results in 0 and ends up as 1..0. This then is covered by: "If the lower bound is greater than the u

Re: FOR integer loop bug?

2022-04-08 Thread Adrian Klaver
On 4/8/22 10:58 AM, Pavel Stehule wrote: pá 8. 4. 2022 v 19:56 odesílatel Adrian Klaver Why is the three period form allowed through and why does it produce no result? Maybe (2022-04-08 19:57:57) postgres=# select .10; ┌──┐ │ ?column? │ ╞══╡ │     0.10 │ └─

Re: Long running processes and commit writing to disk

2022-04-08 Thread Ron
On 4/8/22 11:39, Shaozhong SHI wrote: When long running processes got disrupted, one may not see any expected result. How to make sure that the result of each operation is saved to disk in a loop? That would of course depend on how often you begin and commit transactions. -- Angular momen

Re: FOR integer loop bug?

2022-04-08 Thread Pavel Stehule
pá 8. 4. 2022 v 19:56 odesílatel Adrian Klaver napsal: > Postgres 14.2 > > In commenting on a SO question I came across the below. > > Given: > > CREATE OR REPLACE FUNCTION public.for_loop_test() > RETURNS void > LANGUAGE plpgsql > AS $function$ > BEGIN > FOR i IN 1..10 LOOP > R

FOR integer loop bug?

2022-04-08 Thread Adrian Klaver
Postgres 14.2 In commenting on a SO question I came across the below. Given: CREATE OR REPLACE FUNCTION public.for_loop_test() RETURNS void LANGUAGE plpgsql AS $function$ BEGIN FOR i IN 1..10 LOOP RAISE NOTICE '%', i; END LOOP; END; $function$ ; select for_loop_test(); NOTIC

Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)

2022-04-08 Thread W.P.
> If it is experimental you could try pg_resetwal: https://www.postgresql.org/docs/11/app-pgresetwal.html Found this, had to use -f (program hint), but no luck. Same error. Is there anything else? Problem stille here: during restore (from pg_dumpall on 11 on i386) server on OPi crashed dur

Long running processes and commit writing to disk

2022-04-08 Thread Shaozhong SHI
When long running processes got disrupted, one may not see any expected result. How to make sure that the result of each operation is saved to disk in a loop? Regards, David

Re: What have I done!?!?!? :-)

2022-04-08 Thread Jan Wieck
On 4/8/22 09:58, Jan Wieck wrote: It only affects constraints that have been declared DEFERRABLE. Those that are not are silently ignored (as per SQL standard). I should have said "... silently ignored by this statement and still fire IMMEDIATE". Just to be clear, Jan

Re: What have I done!?!?!? :-)

2022-04-08 Thread Jan Wieck
On 4/8/22 09:27, Magnus Hagander wrote: On Fri, Apr 8, 2022 at 3:23 PM Perry Smith > wrote: It has been a long time since I’ve done Rails stuff.  What follows is the best I can recall but please take it with a grain of salt. The first problem is that

Re: PostgreSQL : error hint for LATERAL join

2022-04-08 Thread David G. Johnston
On Fri, Apr 8, 2022 at 1:29 AM PALAYRET Jacques wrote: > For a LATERAL join, I think the hint (in case of error) is incomplete : > > " DÉTAIL : The combining JOIN type must be INNER or LEFT for a LATERAL > reference. " > to be replaced by : > " DÉTAIL : The combining JOIN type must be CROSS, INN

Re: What have I done!?!?!? :-)

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 3:27 PM Magnus Hagander wrote: > > > On Fri, Apr 8, 2022 at 3:23 PM Perry Smith wrote: > >> >> >> On Apr 8, 2022, at 07:47, Jan Wieck wrote: >> >> On 4/8/22 01:57, Nikolay Samokhvalov wrote: >> >> On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck > mailto:j...@wi3ck.info >> wrote:

Re: What have I done!?!?!? :-)

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 3:23 PM Perry Smith wrote: > > > On Apr 8, 2022, at 07:47, Jan Wieck wrote: > > On 4/8/22 01:57, Nikolay Samokhvalov wrote: > > On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck mailto:j...@wi3ck.info >> wrote: >So **IF** Active Record is using that feature, then it can dump a

Re: What have I done!?!?!? :-)

2022-04-08 Thread Perry Smith
> On Apr 8, 2022, at 08:10, Magnus Hagander wrote: > > > > On Fri, Apr 8, 2022 at 3:07 PM Jan Wieck > wrote: > On 4/8/22 08:58, Magnus Hagander wrote: > > A side-note on this, which of course won't help the OP at this point, > > but if the general best practice of not

Re: What have I done!?!?!? :-)

2022-04-08 Thread Perry Smith
> On Apr 8, 2022, at 07:47, Jan Wieck wrote: > > On 4/8/22 01:57, Nikolay Samokhvalov wrote: >> On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck > > wrote: >>So **IF** Active Record is using that feature, then it can dump any >>amount of garbage into your PostgreSQL data

Re: What have I done!?!?!? :-)

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 3:07 PM Jan Wieck wrote: > On 4/8/22 08:58, Magnus Hagander wrote: > > A side-note on this, which of course won't help the OP at this point, > > but if the general best practice of not running the application with a > > highly privileged account is followed, the problem won

Re: How to get updated order data

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 2:26 PM Laurenz Albe wrote: > On Thu, 2022-04-07 at 16:16 +0300, Andrus wrote: > > Orders are in table > > > > create table order ( > >dokumnr int primary key, > >packno char(10) > >); > > insert into order dokumnr values

Re: What have I done!?!?!? :-)

2022-04-08 Thread Jan Wieck
On 4/8/22 08:58, Magnus Hagander wrote: A side-note on this, which of course won't help the OP at this point, but if the general best practice of not running the application with a highly privileged account is followed, the problem won't occur (it will just fail early before breaking things). D

Re: What have I done!?!?!? :-)

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 7:57 AM Nikolay Samokhvalov wrote: > On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck wrote: > >> So **IF** Active Record is using that feature, then it can dump any >> amount of garbage into your PostgreSQL database and PostgreSQL will >> happily accept it with zero integrity che

Re: What have I done!?!?!? :-)

2022-04-08 Thread Jan Wieck
On 4/8/22 01:57, Nikolay Samokhvalov wrote: On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck > wrote: So **IF** Active Record is using that feature, then it can dump any amount of garbage into your PostgreSQL database and PostgreSQL will happily accept it with zero in

Re: How to get updated order data

2022-04-08 Thread Laurenz Albe
On Thu, 2022-04-07 at 16:16 +0300, Andrus wrote: > Orders are in table > > create table order ( >    dokumnr int primary key, >    packno char(10) >    ); >     insert into order dokumnr values (123); > >  One user sets pack number using > > update orde

Re: Could not read block 0 in file

2022-04-08 Thread Vijaykumar Jain
On Fri, 8 Apr 2022 at 15:31, Vijaykumar Jain < vijaykumarjain.git...@gmail.com> wrote: > > > On Fri, 8 Apr 2022 at 15:24, Magnus Hagander wrote: > >> >> >> On Fri, Apr 8, 2022 at 11:06 AM wrote: >> >>> Hi, >>> >>> While we are looking for a suitable backup to recover from, I hope this >>> commu

Re: Could not read block 0 in file

2022-04-08 Thread Ron
On 4/8/22 04:54, Magnus Hagander wrote: On Fri, Apr 8, 2022 at 11:06 AM wrote: Hi, While we are looking for a suitable backup to recover from, I hope this community may have some other advice on forward steps in case we cannot restore. RCA: Unexpected shutdown due to cr

Re: Could not read block 0 in file

2022-04-08 Thread Vijaykumar Jain
On Fri, 8 Apr 2022 at 15:24, Magnus Hagander wrote: > > > On Fri, Apr 8, 2022 at 11:06 AM wrote: > >> Hi, >> >> While we are looking for a suitable backup to recover from, I hope this >> community may have some other advice on forward steps in case we cannot >> restore. >> >> RCA: Unexpected sh

Re: Could not read block 0 in file

2022-04-08 Thread Magnus Hagander
On Fri, Apr 8, 2022 at 11:06 AM wrote: > Hi, > > While we are looking for a suitable backup to recover from, I hope this > community may have some other advice on forward steps in case we cannot > restore. > > RCA: Unexpected shutdown due to critical power failure > > Current Issue: The file bas

Re: Could not read block 0 in file

2022-04-08 Thread Vijaykumar Jain
On Fri, 8 Apr 2022 at 14:36, wrote: > Hi, > > While we are looking for a suitable backup to recover from, I hope this > community may have some other advice on forward steps in case we cannot > restore. > > RCA: Unexpected shutdown due to critical power failure > > Current Issue: The file base/1

Could not read block 0 in file

2022-04-08 Thread friend . have_00
Hi, While we are looking for a suitable backup to recover from, I hope this community may have some other advice on forward steps in case we cannot restore. RCA: Unexpected shutdown due to critical power failure Current Issue: The file base/16509/17869 is zero bytes in size. Additional Inform

How to get updated order data

2022-04-08 Thread Andrus
Hi! Orders are in table     create table order (   dokumnr int primary key,   packno char(10)   );    insert into order dokumnr values (123); One user sets pack number using     update order set packno='Pack1' where dokumnr=123 3 seconds later other user retrie

PostgreSQL : error hint for LATERAL join

2022-04-08 Thread PALAYRET Jacques
Hello, For a LATERAL join, I think the hint (in case of error) is incomplete : " DÉTAIL : The combining JOIN type must be INNER or LEFT for a LATERAL reference. " to be replaced by : " DÉTAIL : The combining JOIN type must be CROSS, INNER or LEFT for a LATERAL reference. " Note : it depen