Re: WIN1252 vs UTF8 database encoding

2022-05-04 Thread Adrian Klaver
On 5/4/22 14:51, JORGE MALDONADO wrote: Hi, I am currently working with a PostgreSQL database created with *WIN1252 *encoding because the data will be in Spanish language. So, both *Collation* and *Character type* are set to *Spanish_Mexico.1252* After reading a bit more about encoding, it s

WIN1252 vs UTF8 database encoding

2022-05-04 Thread JORGE MALDONADO
Hi, I am currently working with a PostgreSQL database created with *WIN1252 *encoding because the data will be in Spanish language. So, both *Collation* and *Character type* are set to *Spanish_Mexico.1252* After reading a bit more about encoding, it seems to me that I can use *UTF8* encoding so

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
David, thanks but what do you mean by the last comment - On Wed, May 4, 2022 at 7:44 PM David G. Johnston wrote: > Using (SELECT uid FROM myself) provides the same result without the > from/join reference; the usage in the case and the where clause could be > rewritten to use opponent.uid so mys

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 10:23 AM Alexander Farber wrote: > Is that the right way to do it? > > > https://dbfiddle.uk/?rdbms=postgres_14&fiddle=7bd74243397da61ddc4c216ad919c7cc > > WITH myself AS ( > SELECT uid > FROM words_social > WHERE social = in_soci

Re: Backing up a DB excluding certain tables

2022-05-04 Thread Francisco Olarte
Replying to self... On Wed, 4 May 2022 at 19:19, Francisco Olarte wrote: > An I remember pg_dump had a catalog mode, but it seems to have > dissapeared in recent versions ( you gave it a switch, it wrote a > commented list > of IDs which you could edit ( normally avoiding reorders ) and feed > b

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
Is that the right way to do it? https://dbfiddle.uk/?rdbms=postgres_14&fiddle=7bd74243397da61ddc4c216ad919c7cc WITH myself AS ( SELECT uid FROM words_social WHERE social = in_social AND sid = in_sid LIMIT 1 ) SELE

Re: Backing up a DB excluding certain tables

2022-05-04 Thread Francisco Olarte
Jorge: On Wed, 4 May 2022 at 18:12, JORGE MALDONADO wrote: > I just found the solution (or 1 solution). > It seems that the problem resides in tables with names containing characters > other than lowercase letters. > I want to exclude the following tables from the backup: > AspNetRoleClaims > A

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
I think I am very close with the following CTE, but do not understand how to bring it into the main SELECT query: https://dbfiddle.uk/?rdbms=postgres_14&fiddle=ee264dc98b44dee75aa4523164a327b3 WITH myself AS ( SELECT uid FROM words_social WHERE social =

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 9:12 AM Alexander Farber wrote: > I have tried CROSS JOIN and CASE WHEN (why be greedy, right?): > > > https://dbfiddle.uk/?rdbms=postgres_14&fiddle=43a33374d15a9330145007702138822c > > WITH myself AS ( > SELECT uid > FROM words_social >

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
I have tried CROSS JOIN and CASE WHEN (why be greedy, right?): https://dbfiddle.uk/?rdbms=postgres_14&fiddle=43a33374d15a9330145007702138822c WITH myself AS ( SELECT uid FROM words_social WHERE social = in_social AND sid = in_sid

Re: Backing up a DB excluding certain tables

2022-05-04 Thread JORGE MALDONADO
Hello, I just found the solution (or 1 solution). It seems that the problem resides in tables with names containing characters other than lowercase letters. I want to exclude the following tables from the backup: - AspNetRoleClaims - AspNetRoles - AspNetUserClaims - AspNetUserLogins

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 8:53 AM Alexander Farber wrote: > > JOINcte > WHERE c.gid= in_gid > AND (c.uid = myself.uid OR NOT opponent.muted) > ORDER BY c.CREATED ASC; > > ERROR: syntax error at or near "WHERE" > LINE 67: WHERE c.gid= in_gi

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
I try with a CTE but cannot figure the syntax: https://dbfiddle.uk/?rdbms=postgres_14&fiddle=acd6d06a7ea2efc73a0771530832d77e WITH cte AS ( SELECT uid FROM words_social WHERE social = in_social AND sid = in_sid LIMIT 1 )

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 8:36 AM Alexander Farber wrote: > David, I try then the following - > > On Wed, May 4, 2022 at 5:28 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> You missed quoting the part where I describe the on clauses you need to >> distinguish between "them" and "me

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
I am probably needing LEFT JOIN LATERAL here (and am completely lost)? Or to switch to CTE as you suggest

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
David, I try then the following - On Wed, May 4, 2022 at 5:28 PM David G. Johnston wrote: > You missed quoting the part where I describe the on clauses you need to > distinguish between "them" and "me" > > Me: u.uid in (player...) and (s.uid = u.uid) > Them: u.uid in (player...) and (s.uid <> u.

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 8:21 AM Alexander Farber wrote: > David, I am trying your suggestion: > > On Wed, May 4, 2022 at 4:27 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> Assuming the base query is capable of returning all related chat messages >> for both users (I'd probably p

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
David, I am trying your suggestion: On Wed, May 4, 2022 at 4:27 PM David G. Johnston wrote: > Assuming the base query is capable of returning all related chat messages > for both users (I'd probably place that portion into a CTE) the rows you > want to filter out are those whose c.uid is not my

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 7:40 AM Alexander Farber wrote: > > The "social dynamic" is needed, because I cannot pass real user id (via > HTTP) to SQL queries. > > Instead I pass social network type "social" (like 100 is facebook, 200 is > twitter) and the social network id "sid" returned by that netw

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
My real SQL function has one more param, an "auth" string generated by my game, which complements the social network id "sid". I have just omitted it in my test case. >

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
Hi Ron, On Wed, May 4, 2022 at 4:56 PM Ron wrote: > > How do other web sites know to present only "my" data, even though they > don't encode "my" user id in the URL? > > that is the usual pattern with OAuth provided by: Facebook, Google, Amazon, Huawei, etc... After you auth with them in a game

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Ron
On 5/4/22 09:40, Alexander Farber wrote: Thank you for replying, David! The "social dynamic" is needed, because I cannot pass real user id (via HTTP) to SQL queries. How do other web sites know to present only "my" data, even though they don't encode "my" user id in the URL? -- Angular mom

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
Thank you for replying, David! The "social dynamic" is needed, because I cannot pass real user id (via HTTP) to SQL queries. Instead I pass social network type "social" (like 100 is facebook, 200 is twitter) and the social network id "sid" returned by that network. This way noone can read chats b

Re: Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread David G. Johnston
On Wed, May 4, 2022 at 5:48 AM Alexander Farber wrote: > > CREATE OR REPLACE FUNCTION words_get_chat( > in_gidinteger, > in_social integer, > in_sidtext > ) RETURNS TABLE ( > out_mine integer, > out_m

Displaying chat by punished users only to themselves (db fiddle attached)

2022-05-04 Thread Alexander Farber
Hello, I have developed a complete SQL fiddle for my question: https://dbfiddle.uk/?rdbms=postgres_14&fiddle=dcf063ba1615b392cc3cfa347a32c97b The context is that I run an online game for two players using a PostgreSQL 14.2 backend. I would like to make my game more friendly by hiding chat messa

Re: Replication with Patroni not working after killing secondary and starting again

2022-05-04 Thread Peter J. Holzer
On 2022-05-04 10:21:56 +0200, Zb B wrote: > Apparently there is something wrong with my cluster. How to debug i?. > Do I need to configure anything so the replication is synchronous? Does https://patroni.readthedocs.io/en/latest/replication_modes.html help? hp -- _ | Peter J. Holzer

Completely wrong queryplan

2022-05-04 Thread Paul van der Linden
Hi, I'm stumbling on an issue which seems like this one: https://www.postgresql.org/message-id/20170719152038.19353.71475%40wrigleys.postgresql.org, but I hope someone can shed some light on my specific case. Software: POSTGIS="3.1.4 ded6c34" [EXTENSION] PGSQL="140" GEOS="3.8.0-CAPI-1.13.1 " PROJ

Re: Replication with Patroni not working after killing secondary and starting again

2022-05-04 Thread Zb B
> What does `patronictl list` show during that interval? Well. I can't repeat the situation anymore. Now the replication starts immediately after starting the patroni on secondary. I did several switchover commands meanwhile though Meanwhile I did another test where I run a Java app with a large

Re: Whole Database or Table AES encryption

2022-05-04 Thread Aaron Gray
On Fri, 29 Apr 2022 at 00:00, Mladen Gogala wrote: > > There is a commercial product which supports database encryption, including > PostgreSQL, it's called Voltage: > > https://www.techtarget.com/searchsecurity/feature/HP-Security-Voltages-SecureData-Enterprise-Product-overview > > The company t

Re: Whole Database or Table AES encryption

2022-05-04 Thread Aaron Gray
On Fri, 29 Apr 2022 at 00:32, Bruce Momjian wrote: > > On Thu, Apr 28, 2022 at 11:55:09PM +0100, Aaron Gray wrote: > > I would be very interested in this, are there any further pointers as > > to where to look at this ? > > Is there a repo branch in place working on this or any documentation ? >