Bug report #19634

Postgres trigger behaviour using QGIS

Added by Casper Bertelsen almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:3.2 Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:27461

Description

Trying to take advantage of statement-level triggers in Postgres using QGIS, I noticed some unfortunate behaviour.

Take this example:

Inserting two rows into a table in QGIS and then pressing save is processed as two separate statements, instead of one statement inserting two rows.

To replicate the behaviour in postgres, when pressing save, having inserted the two rows would be equivalent to the following SQL:

-- Row 1
INSERT INTO table VALUES (xx);
-- Row 2
INSERT INTO table VALUES (yy);

-- Statement-level trigger would fire twice.

Instead of this behaviour:

INSERT INTO table VALUES
(xx), -- Row 1
(yy); -- Row 2

-- Statement-level trigger would fire once.

The same behaviour is applied when updating. :-(

Is this the intended behaviour using Postgres with QGIS?

History

#1 Updated by Jürgen Fischer almost 2 years ago

  • Resolution set to worksforme
  • Status changed from Open to Closed

Casper Bertelsen wrote:

Is this the intended behaviour using Postgres with QGIS?

Yes. Actually we are using prepared inserts (see source:src/providers/postgres/qgspostgresprovider.cpp#L1993)

#2 Updated by Casper Bertelsen almost 2 years ago

Jürgen Fischer wrote:

Casper Bertelsen wrote:

Is this the intended behaviour using Postgres with QGIS?

Yes. Actually we are using prepared inserts (see source:src/providers/postgres/qgspostgresprovider.cpp#L1993)

Unfortunate.

Also available in: Atom PDF