Re: How to update a table with the result of deleting rows in another table

2020-10-05 Thread Pankaj Jangid
On Tue, Oct 06 2020, Hemil Ruparel wrote: > with data as ( > delete from orders > where customer_id = > and date = '2020-10-05' returning price > ), total as ( > select sum(price) from data > ) > update paymentdetail > set temp_credit = temp_credit + (select * from total) > w

How to update a table with the result of deleting rows in another table

2020-10-05 Thread Hemil Ruparel
I am trying to delete orders for a given customer on a given date and add the cost of those orders to credit for the customer. So far, I came up with this: ``` with data as ( delete from orders where customer_id = and date = '2020-10-05' returning price ), total as ( select su

回复: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Han Parker
发件人: Tatsuo Ishii 发送时间: 2020年10月6日 2:15 收件人: t...@sss.pgh.pa.us 抄送: parker@outlook.com ; pgsql-gene...@postgresql.org 主题: Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered? > Hmm ... interesting idea, basically invent our ow

Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Tatsuo Ishii
> But as he already admitted, actually GB18030 is 4 byte encoding, rather > than 2 bytes. So maybe we could find a way to map original GB18030 to > ASCII-safe GB18030 using 4 bytes. Here is an idea (in-byte represents GB18030, out-byte represents internal server encoding): if (in-byte1 is 0x00-80

Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Tatsuo Ishii
> Hmm ... interesting idea, basically invent our own modified version > of GB18030 (or SJIS?) for backend-internal storage. But I'm not > sure how to make it work without enlarging the string, which'd defeat > the OP's argument. It looks to me like the second-byte code space is > already pretty f

Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Tom Lane
Tatsuo Ishii writes: > One of ideas to avoid the concern could be "shifting" GB18030 code > points into "ASCII safe" code range with some calculations so that > backend can handle them without worrying about the concern above. This > way, we could avoid a table lookup overhead which is necessary i

Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Tatsuo Ishii
> TBH, even if you came up with a complete patch, we'd probably > reject it as unmaintainable and a security hazard. The problem > is that code may scan a string looking for certain ASCII characters > such as backslash (\), which up to now it's always been able to do > byte-by-byte without fear th

Re: UUID generation problem

2020-10-05 Thread David G. Johnston
On Monday, October 5, 2020, James B. Byrne wrote: > > idempiere(5432)=# alter role "idempiere_dbadmin" set search_path = > 'adempiere, > public'; > ALTER ROLE > idempiere(5432)=# select current_schemas(true); > current_schemas > - > {pg_catalog} > (1 row) > > This does not look

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
[root@accounting-2 ~ (master)]# psql -E --dbname=idempiere --username=idempiere_dbadmin --host=localhost Password for user idempiere_dbadmin: psql (11.8) Type "help" for help. idempiere(5432)=# select current_schemas(true); current_schemas - {pg_catalog} (1 row) idempiere(5432

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 15:35, David G. Johnston wrote: > On Monday, October 5, 2020, James B. Byrne wrote: > >> >> >> I am so confused by this. I tried to do this: >> >> [root@accounting-2 ~ (master)]# psql -E --dbname=idempiere >> --username=idempiere_dbadmin --host=localhost >> Password fo

Re: UUID generation problem

2020-10-05 Thread David G. Johnston
On Monday, October 5, 2020, James B. Byrne wrote: > > > I am so confused by this. I tried to do this: > > [root@accounting-2 ~ (master)]# psql -E --dbname=idempiere > --username=idempiere_dbadmin --host=localhost > Password for user idempiere_dbadmin: > psql (11.8) > Type "help" for help. > > i

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 12:03 PM, James B. Byrne wrote: On Mon, October 5, 2020 13:34, Paul Förster wrote: well, actually, you can just set the search_path for the role the application logs in with: alter role set search_path = ', pg_catalog, public'; The next time logs in, it should see the freshly

Re: Writing WAL files

2020-10-05 Thread David G. Johnston
On Monday, October 5, 2020, Robert Inder wrote: > But the change Adrian Klaverd highlighted suggests that this is > deliberately no longer the case, > and I am left wondering what it does, in fact do/mean now. > “If no WAL has been written since the previous checkpoint, new checkpoints will be s

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 15:20, Adrian Klaver wrote: > > The uuid-extension needs to be installed by a super user: > . . . > > So postgres is probably as good as any. > > I was just pointing out that what you posted earlier: > > 2000 2020-09-11 16:15:17: psql -d idempiere -U adempiere -c 'CREATE

Re: Writing WAL files

2020-10-05 Thread Robert Inder
On Mon, 5 Oct 2020 at 18:29, Michael Lewis wrote: > > If you setup a scripted process to update a single row with a timestamptz > on the source/primary every minute, then you have a very simple consistent > change and also a way to check on the replica what is current time vs > last_scripted_upda

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 12:09 PM, James B. Byrne wrote: On Mon, October 5, 2020 13:46, Adrian Klaver wrote: The thing is, from upstream: idempiere=# \df+ uuid_generate_v4 List of functions Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel |

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 13:46, Adrian Klaver wrote: > The thing is, from upstream: > > idempiere=# \df+ uuid_generate_v4 > > List > of > functions > Schema | Name | Result data type | Argument data types | > Type | > Volatility | Parallel | Owner | Security | Access

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 13:34, Paul Förster wrote: > > well, actually, you can just set the search_path for the role the application > logs in with: > > alter role set search_path = ', pg_catalog, public'; > > The next time logs in, it should see the freshly set search_path. > > When we creat

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 13:31, Adrian Klaver wrote: > > That is because I sent the wrong prompt:( It should have been: > > \set PROMPT1 '%/(%>)%R%# ' > idempiere=# \set PROMPT1 '%/(%>)%R%# ' idempiere(5432)=# That works. -- *** e-Mail is NOT a SECURE channel *** Do N

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 13:24, Adrian Klaver wrote: > > To confirm what role this is assigned to do: > > select rolname from pg_authid where oid = 21328; > idempiere=# select rolname from pg_authid where oid = 21328; rolname --- idempiere_dbadmin (1 row) -- *** e

Re: UUID generation problem

2020-10-05 Thread Tom Lane
"James B. Byrne" writes: >> It might be worth poking into the pg_db_role_setting catalog, >> which is the most likely source of a different search_path for >> different connections. > It seems so: > idempiere=# SELECT * FROM pg_db_role_setting; > setdatabase | setrole | setconfig

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 9:31 AM, James B. Byrne wrote: On Mon, October 5, 2020 11:52, Adrian Klaver wrote: That is the natural order of events. The database has to exist before you can add an extension to it. Unless you are saying that you did not build the extension until after the database was created.

Re: UUID generation problem

2020-10-05 Thread Paul Förster
Hi James, > On 05. Oct, 2020, at 19:16, James B. Byrne wrote: > > As this is an application package it is not within my purview to alter the > code. To do so would rik a return of the problem with every update. > > Adding public to the search path is fine by me. However, I still need to find

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 9:46 AM, James B. Byrne wrote: On Mon, October 5, 2020 12:08, Adrian Klaver wrote: On 10/5/20 8:57 AM, James B. Byrne wrote: On Mon, October 5, 2020 11:15, Adrian Klaver wrote: Per Tom's post this does not make sense. What if you connect doing?: psql --dbname=idempiere --user

Re: Writing WAL files

2020-10-05 Thread Michael Lewis
> I suggest that in PG12 you can monitor the >> "lag" of a standby server more directly by looking at columns write_lag, >> flush_lag, replay_lag in the pg_stat_replication view. > > > And are those things updated when there are no changes to the master > database? > If so, can anyone make the case

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 9:59 AM, James B. Byrne wrote: On Mon, October 5, 2020 12:51, Tom Lane wrote: "James B. Byrne" writes: [root@accounting-2 ~ (master)]# psql --dbname=idempiere --username=idempiere_dbadmin --host=localhost Password for user idempiere_dbadmin: psql (11.8) Type "help" for help. i

Re: UUID generation problem

2020-10-05 Thread Paul Förster
Hi Adrian, > On 05. Oct, 2020, at 19:20, Adrian Klaver wrote: > Actually it does: > > From the prompt I'm guessing you are logging in as 'postgres' user. In that > case "$user" will become postgres and you will get: > > postgres=# select current_schemas(false); > current_schemas > ---

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 9:19 AM, Paul Förster wrote: Hi James, On 05. Oct, 2020, at 17:57, James B. Byrne wrote: [root@accounting-2 ~ (master)]# psql --dbname=idempiere --username=idempiere_dbadmin Password for user idempiere_dbadmin: psql (11.8) Type "help" for help. idempiere=# select current_schemas(t

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 13:07, Paul Förster wrote: > > I guess that's why you don't see the uuid_generate_v4() function. I suggest > you > either fully qualify it, i.e. public.uuid_generate_v4() or add public to your > search path. As this is an application package it is not within my purview

Re: UUID generation problem

2020-10-05 Thread Paul Förster
Hi James, > idempiere=# select uuid_generate_v4(); > ERROR: function uuid_generate_v4() does not exist > LINE 1: select uuid_generate_v4(); > ^ > HINT: No function matches the given name and argument types. You might need > to > add explicit type casts. > idempiere=# select public

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 12:51, Tom Lane wrote: > "James B. Byrne" writes: >> [root@accounting-2 ~ (master)]# psql --dbname=idempiere >> --username=idempiere_dbadmin --host=localhost >> Password for user idempiere_dbadmin: >> psql (11.8) >> Type "help" for help. > >> idempiere=# select current_

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 12:19, Paul Förster wrote: > > just out of curiosity, what does the search_path contain? It needs not > necessarily reflect the contents of current_schemas, see the following > example: > > postgres=# select current_schemas(true); >current_schemas >

Re: UUID generation problem

2020-10-05 Thread Tom Lane
"James B. Byrne" writes: > [root@accounting-2 ~ (master)]# psql --dbname=idempiere > --username=idempiere_dbadmin --host=localhost > Password for user idempiere_dbadmin: > psql (11.8) > Type "help" for help. > idempiere=# select current_schemas(true); > current_schemas >

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 12:12, Adrian Klaver wrote: > > Also I would do at system command line: > > ps ax | grep post > > to see how many instances of Postgres you have running. > [root@accounting-2 ~ (master)]# ps ax | grep post 20028 - IsJ 0:00.04 postgres: idempiere_dbadmin idempiere 127

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 12:08, Adrian Klaver wrote: > On 10/5/20 8:57 AM, James B. Byrne wrote: >> >> >> On Mon, October 5, 2020 11:15, Adrian Klaver wrote: >>> >>> Per Tom's post this does not make sense. >>> >>> What if you connect doing?: >>> >>> psql --dbname=idempiere --username=idempiere_d

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 12:06, Tom Lane wrote: > "James B. Byrne" writes: >> On Mon, October 5, 2020 10:53, Tom Lane wrote: >>> I continue to suspect that you are somehow >>> confusing yourself by testing in different databases and/or >>> with different user accounts. > >> Possibly. I do not m

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 11:52, Adrian Klaver wrote: > That is the natural order of events. The database has to exist before > you can add an extension to it. Unless you are saying that you did not > build the extension until after the database was created. > That is the meaning that I meant to

Re: UUID generation problem

2020-10-05 Thread Paul Förster
Hi James, > On 05. Oct, 2020, at 17:57, James B. Byrne wrote: > > [root@accounting-2 ~ (master)]# psql --dbname=idempiere > --username=idempiere_dbadmin > Password for user idempiere_dbadmin: > psql (11.8) > Type "help" for help. > > idempiere=# select current_schemas(true); >current_schema

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 8:57 AM, James B. Byrne wrote: On Mon, October 5, 2020 11:15, Adrian Klaver wrote: Per Tom's post this does not make sense. What if you connect doing?: psql --dbname=idempiere --username=idempiere_dbadmin And specify the port(-p) Cut out the sudo. Then do: select current_sch

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 8:57 AM, James B. Byrne wrote: On Mon, October 5, 2020 11:15, Adrian Klaver wrote: Per Tom's post this does not make sense. What if you connect doing?: psql --dbname=idempiere --username=idempiere_dbadmin And specify the port(-p) Cut out the sudo. Then do: select current_sch

Re: UUID generation problem

2020-10-05 Thread Tom Lane
"James B. Byrne" writes: > On Mon, October 5, 2020 10:53, Tom Lane wrote: >> I continue to suspect that you are somehow >> confusing yourself by testing in different databases and/or >> with different user accounts. > Possibly. I do not make any definitive claims at this point. However, the > a

Re: How to execute the sql file in PSQL

2020-10-05 Thread Tom Lane
Adrian Klaver writes: > On 10/5/20 7:55 AM, Mark wrote: >> I followed one PostgreSQL tutorial step by step. One session to use PSQL >> to execute sql files to create a new database in PostgreSQL. >> 1.  copy  paste the sql file within "C:\Program Files\PostgreSQL\12" >> directory. >> 2.  execut

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 11:15, Adrian Klaver wrote: > > Per Tom's post this does not make sense. > > What if you connect doing?: > > psql --dbname=idempiere --username=idempiere_dbadmin > > And specify the port(-p) > > Cut out the sudo. > > > Then do: > > select current_schemas(true); > > select

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 8:43 AM, James B. Byrne wrote: On Mon, October 5, 2020 10:53, Tom Lane wrote: That seems to show quite definitively that public is not in your search_path, which contradicts the current_schemas() result you gave earlier. I continue to suspect that you are somehow confusing yoursel

Re: What's your experience with using Postgres in IoT-contexts?

2020-10-05 Thread Diego
I use pg in my raspberrypy 3b, for a weather station and works fine, but to be honest, I have a sencond raspi with a pgbouncer and a pendrive of 256GBs as data storage In other, I have a zabbix server with pg monitoring aboutn 100 devices, but with an external hdd. but, at the end of the day

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 10:53, Tom Lane wrote: > That seems to show quite definitively that public is not in your > search_path, which contradicts the current_schemas() result you > gave earlier. I continue to suspect that you are somehow > confusing yourself by testing in different databases

Re: How to execute the sql file in PSQL

2020-10-05 Thread Adrian Klaver
On 10/5/20 7:55 AM, Mark wrote: Stackoverflow question link: https://stackoverflow.com/questions/64210281/using-psql-executing-sql-format-file-shows-permission-denied-on-windows-platform I followed one PostgreSQL tutorial step by step. One session to use PSQL to execute sql files to create

How to execute the sql file in PSQL

2020-10-05 Thread Mark
Stackoverflow question link: https://stackoverflow.com/questions/64210281/using-psql-executing-sql-format-file-shows-permission-denied-on-windows-platform I followed one PostgreSQL tutorial step by step. One session to use PSQL to execute sql files to create a new database in PostgreSQL. 1.

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 7:22 AM, James B. Byrne wrote: On Mon, October 5, 2020 10:18, Adrian Klaver wrote: So as same user: select uuid_generate_v4(); select public.uuid_generate_v4(); \dn+ public [root@accounting-2 ~ (master)]# sudo -u postgres psql --dbname=idempiere --username=idempiere_dbadmin Pa

Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0

2020-10-05 Thread Matthias Apitz
El día lunes, octubre 05, 2020 a las 04:49:27p. m. +0200, Mario Emmenlauer escribió: > On 05.10.20 13:22, Mario Emmenlauer wrote: > > I've used PostgreSQL since version 9.x successfully on Linux, macOS > > and Windows. Today I've upgraded from 12.3 to 13.0 and suddenly I can > > not start the ser

Re: UUID generation problem

2020-10-05 Thread Tom Lane
"James B. Byrne" writes: > idempiere=# select uuid_generate_v4(); > ERROR: function uuid_generate_v4() does not exist > LINE 1: select uuid_generate_v4(); >^ > HINT: No function matches the given name and argument types. You might need > to > add explicit type casts. > idempiere

Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0

2020-10-05 Thread Mario Emmenlauer
On 05.10.20 13:22, Mario Emmenlauer wrote: > I've used PostgreSQL since version 9.x successfully on Linux, macOS > and Windows. Today I've upgraded from 12.3 to 13.0 and suddenly I can > not start the server any more on Ubuntu 20.04 (inside Docker on Ubuntu > 18.04) and on macOS 10.15. > > I get r

Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0

2020-10-05 Thread Tom Lane
Mario Emmenlauer writes: > I get reproducibly the error: > 2020-10-05 11:48:19.720 CEST [84731] WARNING: dup(0) failed after 0 > successes: Bad file descriptor Hmph. That code loop assumes that stdin exists to be duplicated, but maybe if it had been closed, you'd get this error. However, that

Re: What's your experience with using Postgres in IoT-contexts?

2020-10-05 Thread Thorsten Schöning
Guten Tag Tony Shelver, am Montag, 5. Oktober 2020 um 15:44 schrieben Sie: > Not sure about PG in that environment. Have you thought about something > like H2 java database? https://www.h2database.com/html/main.html Yes, like SQLite as well. The point is that I was really interested in keeping a

Re: What's your experience with using Postgres in IoT-contexts?

2020-10-05 Thread Tony Shelver
Not sure about PG in that environment. Have you thought about something like H2 java database? https://www.h2database.com/html/main.html That is included as the standarDB in a vehicle tracking system we use, although we have re[placed with PG. On Mon, 5 Oct 2020 at 11:20, Thorsten Schöning wrot

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Mon, October 5, 2020 10:18, Adrian Klaver wrote: > So as same user: > > select uuid_generate_v4(); > > select public.uuid_generate_v4(); > > \dn+ public > [root@accounting-2 ~ (master)]# sudo -u postgres psql --dbname=idempiere --username=idempiere_dbadmin Password for user idempiere_dbadmin

Re: UUID generation problem

2020-10-05 Thread Adrian Klaver
On 10/5/20 6:18 AM, James B. Byrne wrote: On Sat, October 3, 2020 00:28, Adrian Klaver wrote: I'm not sure that is going to help. You are not, AFAICT, getting any permission denied messages. What does: \df+ uuid_generate_v4 show under Access privileges? What does: select current_schemas(

Re: UUID generation problem

2020-10-05 Thread James B. Byrne
On Sat, October 3, 2020 00:28, Adrian Klaver wrote: > > I'm not sure that is going to help. You are not, AFAICT, getting any > permission denied messages. > > What does: > > \df+ uuid_generate_v4 > > show under Access privileges? > > What does: > > select current_schemas(true); > > show? > > id

Re: 回复: May "PostgreSQL server side GB18030 character set support" reconsidered?

2020-10-05 Thread Tatsuo Ishii
>> 1. In this big data and mobile era, in the country with most population, 50% >> more disk energy consuming for Chinese characters (UTF-8 usually 3 bytes for >> a Chinese character, while GB180830 only 2 bytes) is indeed a harm to >> "Carbon Neutral", along with Polar ice melting. > > Really

dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0

2020-10-05 Thread Mario Emmenlauer
Dear All, I've used PostgreSQL since version 9.x successfully on Linux, macOS and Windows. Today I've upgraded from 12.3 to 13.0 and suddenly I can not start the server any more on Ubuntu 20.04 (inside Docker on Ubuntu 18.04) and on macOS 10.15. I get reproducibly the error: 2020-10-05 11:48:19

Re: Cluster and Vacuum Full

2020-10-05 Thread Guillaume Lelarge
Le lun. 5 oct. 2020 à 12:22, PegoraroF10 a écrit : > I have tables which are Master Detail and usually my program loads all > detail > records of a master record. So I configured CLUSTER on all those detail > tables to use an index which is the relation with master table. With that I > can load l

Cluster and Vacuum Full

2020-10-05 Thread PegoraroF10
I have tables which are Master Detail and usually my program loads all detail records of a master record. So I configured CLUSTER on all those detail tables to use an index which is the relation with master table. With that I can load less records to Shared Buffers because all detaild records are o

What's your experience with using Postgres in IoT-contexts?

2020-10-05 Thread Thorsten Schöning
Hi all, TL;DR: Does anyone actually use Postgres with ARM based low performance hardware and only 256 MiB of RAM? What are your experiences in other stripped down environments? Is there some lower RAM limit with which using Postgres doesn't make any sense anymore? Is Postgres able to compete with

Re: which git workflow is used by pg comminuty developers?

2020-10-05 Thread Ian Barwick
On 2020/10/05 16:58, ZHAOWANCHENG wrote: Is one of Git Flow/Github Flow/Gitlab Flow? and why? See: https://wiki.postgresql.org/wiki/Working_with_Git Regards Ian Barwick -- Ian Barwick https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

which git workflow is used by pg comminuty developers?

2020-10-05 Thread ZHAOWANCHENG
Is one of Git Flow/Github Flow/Gitlab Flow? and why?