Database schema for "custom fields"

2024-09-09 Thread Matthias Leisi
I’m looking for input on a database design question. Suppose you have an application that allows the user to add some kind of field to the application („custom fields“, „user defined fields“, „extended fields“, …), which could be of different types (eg string, int, bool, date, array of , …), a

Re: Check used privilege in a statment

2024-09-09 Thread Tom Lane
Ahmed Ibrahim writes: > I am trying to know which privileges are used in a specific query but I am > facing problems when I have nested queries. Where is the best place/hook I > can check for all needed permissions for a query in the source? Currently, > trying it in the exectuter start but the ne

Check used privilege in a statment

2024-09-09 Thread Ahmed Ibrahim
Hi, I am trying to know which privileges are used in a specific query but I am facing problems when I have nested queries. Where is the best place/hook I can check for all needed permissions for a query in the source? Currently, trying it in the exectuter start but the nested queries are problemati

Re: Strange permission effect depending on DEFERRABILITY

2024-09-09 Thread Laurenz Albe
On Mon, 2024-09-09 at 16:14 +0300, Achilleas Mantzios - cloud wrote: > The below runs on PostgreSQL 16.4 > > We are trying to implement a certain operation based on a security definer > function : mariner_update_availability_date > > This is supposed to update a table : mariner , which has severa

Re: postgresql FDW vs dblink for DDL

2024-09-09 Thread Achilleas Mantzios
Στις 9/9/24 18:40, ο/η Tom Lane έγραψε: Adrian Klaver writes: On 9/9/24 03:24, Achilleas Mantzios - cloud wrote: And the thing is that this creation via DDL is inside our design. Certain users create some backup tables of the public data in their own schema (via our app), then do some manipula

Re: Clarify this MERGE warning? "Only columns from the target table that attempt to match data_source rows should appear in join_condition."

2024-09-09 Thread Adrian Klaver
On 9/9/24 06:02, Philip Hazelden wrote: The MERGE docs[1] give this warning: Only columns from the target table that attempt to match `data_source` rows should appear in `join_condition`. `join_condition` subexpressions that only reference the target table's columns can affect which action is t

Re: ssh to DB server and su normal users very slow :

2024-09-09 Thread Thiemo Kellner
Hi What does the server side do in the wait time? Cheers Thiemo

Re: postgresql FDW vs dblink for DDL

2024-09-09 Thread Tom Lane
Adrian Klaver writes: > On 9/9/24 03:24, Achilleas Mantzios - cloud wrote: >> And the thing is that this creation via DDL is inside our design. >> Certain users create some backup tables of the public data in their own >> schema (via our app), then do some manipulations on the public data, >> t

Re: How effectively do the indexing in postgres in such cases

2024-09-09 Thread Greg Sabino Mullane
Your questions are a little too vague to answer well, but let me try a bit. 1)In the query below , if the optimizer chooses tab1 as the driving table, > the index on just col1 should be enough or it should be (col1, tab1_id)? > No way to tell without trying it yourself. We need information on how

Re: postgresql FDW vs dblink for DDL

2024-09-09 Thread Adrian Klaver
On 9/9/24 03:24, Achilleas Mantzios - cloud wrote: On 9/8/24 23:46, Adrian Klaver wrote: On 9/8/24 13:04, Achilleas Mantzios wrote: Hi for remote DDL execution (such as CREATE TABLE) is dblink my only option? You will need to define in what context you are considering options. For instanc

Re: Connection between PostgreSQL and SAP HANA database

2024-09-09 Thread Adrian Klaver
On 9/9/24 00:53, Thürmann, Andreas wrote: Hello everyone, I'm currently trying to establish a connection between PostgreSQL and a SAP HANA database. Unfortunately, so far without success. SAP's own ODBC driver works correctly and I can query the HANA database using an ISQL command. However,

Re: infinite loop in an update statement

2024-09-09 Thread Adrian Klaver
On 9/9/24 07:55, Fabrice Chapuis wrote: Hi, table a and b are empty, this query does not return. It seems we enter in infinite loop. why this update does not return instantly? UPDATE table_a a  SET col1 = (SELECT MIN(b.col1)                     FROM table_b b                     WHERE b.co

Re: infinite loop in an update statement

2024-09-09 Thread Tom Lane
Fabrice Chapuis writes: > why this update does not return instantly? > UPDATE table_a a > SET col1 = (SELECT MIN(b.col1) > FROM table_b b > WHERE b.col2 = a.col2) Maybe query is waiting for a lock on one of those tables? regards,

Re: Strange permission effect depending on DEFERRABILITY

2024-09-09 Thread Achilleas Mantzios - cloud
On 9/9/24 17:21, Tom Lane wrote: Achilleas Mantzios - cloud writes: As you noticed the last trigger is a CONSTRAINT DEFERRABLE trigger. This function mariner_update_availability_date is supposed to be run by a user : cbt_results_import strippedof any privileges to the rest of the system. Here

infinite loop in an update statement

2024-09-09 Thread Fabrice Chapuis
Hi, table a and b are empty, this query does not return. It seems we enter in infinite loop. why this update does not return instantly? UPDATE table_a a SET col1 = (SELECT MIN(b.col1) FROM table_b b WHERE b.col2 = a.col2) Regards, Fabrice

Logical replication without direct link between publisher and subscriber?

2024-09-09 Thread Koen De Groote
I want to have a PG instance receive logical replication from a publisher. However, the subscriber should not have network access to the publisher, in any way. This is for security reasons. No VPN or any setup that allows the subscriber to send traffic to the publisher host. The publisher, howeve

Re: Strange permission effect depending on DEFERRABILITY

2024-09-09 Thread Tom Lane
Achilleas Mantzios - cloud writes: > As you noticed the last trigger is a CONSTRAINT DEFERRABLE trigger. This > function mariner_update_availability_date is supposed to be run by a > user : cbt_results_import strippedof any privileges to the rest of the > system. Here is what we get : when we S

Clarify this MERGE warning? "Only columns from the target table that attempt to match data_source rows should appear in join_condition."

2024-09-09 Thread Philip Hazelden
The MERGE docs[1] give this warning: > Only columns from the target table that attempt to match > `data_source` rows should appear in `join_condition`. > `join_condition` subexpressions that only reference the target > table's columns can affect which action is taken, often in > surprising ways.

Connection between PostgreSQL and SAP HANA database

2024-09-09 Thread Thürmann , Andreas
Hello everyone, I'm currently trying to establish a connection between PostgreSQL and a SAP HANA database. Unfortunately, so far without success. SAP's own ODBC driver works correctly and I can query the HANA database using an ISQL command. However, I can't establish a connection from PostgreSQL

Re: ssh to DB server and su normal users very slow :

2024-09-09 Thread Achilleas Mantzios - cloud
On 9/9/24 16:18, KK CHN wrote: update :  the      ssh -v root@db_Server_IP from my Windows cmd   pasted below for more details Why is your windows cmd important here, show ssh debugging from your DB host to the pgbackrest host. On Mon, Sep 9, 2024 at 4:50 PM KK CHN wrote: List,

Re: ssh to DB server and su normal users very slow :

2024-09-09 Thread KK CHN
update : the ssh -v root@db_Server_IP from my Windows cmd pasted below for more details On Mon, Sep 9, 2024 at 4:50 PM KK CHN wrote: > List, > > I have configured pgbackrest for the DB server and Repo Server(created the > stanza info check all fine. in these machines. > > > /var/spoo

Strange permission effect depending on DEFERRABILITY

2024-09-09 Thread Achilleas Mantzios - cloud
Dear List The below runs on PostgreSQL 16.4 We are trying to implement a certain operation based on a security definer function : mariner_update_availability_date This is supposed to update a table : mariner , which has several other triggers : mariner_build_natural_id_tg BEFORE INSERT OR

ssh to DB server and su normal users very slow :

2024-09-09 Thread KK CHN
List, I have configured pgbackrest for the DB server and Repo Server(created the stanza info check all fine. in these machines. /var/spool/pgbackrest shows the .Okfor each WAL and the Repo server receiving the archiving of WAL in the archive directory . I didn't schedule a pgbackre

Re: postgresql FDW vs dblink for DDL

2024-09-09 Thread Achilleas Mantzios - cloud
On 9/8/24 23:46, Adrian Klaver wrote: On 9/8/24 13:04, Achilleas Mantzios wrote: Hi for remote DDL execution (such as CREATE TABLE) is dblink my only option? You will need to define in what context you are considering options. For instance you can do remote DDL operations by passing a com

Re: Faster data load

2024-09-09 Thread Dominique Devienne
On Sun, Sep 8, 2024 at 8:27 PM Adrian Klaver wrote: > > simple INSERT ... SELECT was more than twice as fast as 8 parallel COPY > > operations (and about 8 times as fast as a single COPY). > > Yeah they seem to have changed a great deal. Though you are correct in > saying COPY is not faster then