448 Commits

Author SHA1 Message Date
Sandro Santilli
51da2ef551 Trust primary key of layers setup by DBManager TopoViewer plugin
Removes two very expensive queries per TopoViewer instance
Closes #47389
2022-02-16 16:35:37 +01:00
nicogodet
ea981d89f9 Homogenize toMapLayer function definition 2021-11-08 10:13:28 +11:00
nicogodet
40df6ec76b Add geometryType() method to root Table class 2021-11-03 18:09:27 +01:00
Alessandro Pasotti
a329b88289 Fix DB manager trigger info dlg (less than)
Fix #45420
2021-10-19 05:37:20 +10:00
Augustin Trancart
061b810dac Fix behaviour of triggers when logging an existing layer
When adding logging via db manager to an existing layer, all the
time_start of existing features are still null. When we modify one
feature for the first time, the update trigger fires and insert a row
for the past state of the feature. In turn, this fires the INSERT
trigger for this row, and the execution goes inside the `if
NEW.time_start is NULL`, which set the end timestamp to NULL, making the
old row still visible in the _current view.

In other word, the insert trigger makes the assumption that a null start
timestamp means now, which is not true in the case described above.

This commit fixes this assumption by initially setting it to `-infinity`
for existing rows.
2021-10-06 12:00:39 +10:00
Alessandro Pasotti
5a572dacaa Fix DB manager postgis double query
Fixes #45318
2021-10-02 07:18:18 +10:00
Loïc Bartoletti
98ff01ea1c
Fix Z/M dimension URI via DB Manager. Fixes #34894 (#45223) 2021-09-28 21:14:45 +02:00
Andrea Giudiceandrea
828638f661
[DB Manager] Fix No Geometry tables
Avoid to add a nonexistent 'geometry' field to the fields list of No Geometry tables.
2021-04-23 08:25:14 +02:00
Andrea Giudiceandrea
2538612a21
[DB Manager] Fix recognition of project layers with Z/M…
…or CurvePolygon/MultyCurve/... geometry types as spatial layers.
2021-04-23 08:14:57 +02:00
Julien Cabieces
1821d7af47 Run providers tests in different CI jobs 2021-03-23 10:53:38 +01:00
Marco Bernasocchi
60f788c91d
Allow loading GPKG layers with GEOMETRY type (#42253) 2021-03-16 15:58:55 +01:00
Nyall Dawson
1040fe8705 Don't silently swallow exceptions in python context managers
Notably this causes processing modules to silently fail to load
without any warnings if the required dependancies (such as pyscopg2)
are not installed
2021-03-04 07:39:47 +10:00
Evan Derickson
63e77371f6 List comprehensions to generators 2021-01-24 16:26:53 -08:00
Evan Derickson
beefb9ed45 Replace str format with str cast 2021-01-23 20:09:01 -08:00
Evan Derickson
4e41ee6db2 More list comprehensions, str.join() 2021-01-23 20:06:27 -08:00
Evan Derickson
4b50c1a7a7 For loops to list comprehension 2021-01-23 16:06:29 -08:00
Alessandro Pasotti
3a2b8f889a Optimize column information 2020-12-21 11:36:47 +01:00
Alessandro Pasotti
6cbbf5ebd1 DB manager: PG read enum value for sslmode
Fixes #38245
2020-11-16 13:13:21 +10:00
Denis Rouzaud
eddf6feb45 modernize CMakeLists.txt files 2020-11-12 07:14:46 +10:00
Nyall Dawson
8c623b268e Revert "DB manager: PG read enum value for sslmode"
This reverts commit 26e9ec98e76591286576d2dde098578877bef9c0.

It results in unfixable crashes on many platforms, likely due to some
issue in sip itself

Fixes #38393, reopens #38245

The original bug (being asked twice for credentials) is preferable
over a hard crash
2020-10-23 08:22:15 +10:00
Alessandro Pasotti
eb3c78d12d DB manager fix add comment while creating table
Fixes #38394
2020-09-25 10:56:13 +02:00
Alessandro Pasotti
3b6178ad3b
Merge pull request #38981 from elpaso/bugfix-gh38975-and-other-db-manager-issues
Bugfix gh38975 and other db manager issues
2020-09-24 18:42:56 +02:00
Alessandro Pasotti
871f534ef9 Fix PG db-manager rename schema
Fixes #38998
2020-09-24 14:23:26 +02:00
Alessandro Pasotti
9880a751a9 DB manager Fix SHOW in PG queries
Fixes #8975
2020-09-23 15:14:04 +02:00
Alessandro Pasotti
ef02c54252 Be smart when adding limit: followup #8092 2020-09-22 09:26:13 +02:00
Alessandro Pasotti
d54c3101ae Add feedback to executeSql
Fixes #38092 by adding an optional QgsFeedback argument to
the executeSql method and by implementing the PQCancel
method in the PG provider internals.

While the cancellation works well for all supported provider while
fetching results in the loop, the cancellation of a running query is now
implemented for the postgres provider connection only because the GPKG
and GDAL both rely on GDALDatasetExecuteSQL which cannot be interrupted.

This PR also introduce a few optimizations in the PG DB-Manager
code that should probably fix also other "slowness" issues that
were reported after 3.x during PG query execution.

A small UX change in th SQL dialog makes it evident to the user that
a cancellation request has been sent to the backend: the button text
is changed to "Cancellation requested, please wait..." so that for
provider connections that are not able to interrupt the running query
and must wait for the fetching loop to exit from the exeuteSql call
the user knows that something is happening and that a cancellation
request has been successfully sent.
2020-09-19 11:15:41 +02:00
Alessandro Pasotti
26e9ec98e7 DB manager: PG read enum value for sslmode
Fixes #38245
2020-08-13 12:48:02 +02:00
Alessandro Pasotti
21f6f576b9 Fix DB manager date time display in SQL window
Fixes #35140
2020-06-09 08:35:31 +10:00
nirvn
291ba7f2dc {Qgis,QGis} -> QGIS 2020-06-06 17:45:43 +07:00
Nyall Dawson
b6a7a10703 Fix some more python formatting issues, remove more flake exceptions 2020-05-11 11:41:50 +10:00
Matthias Kuhn
0afe134076 Noqa 2020-05-05 23:43:27 +02:00
Matthias Kuhn
9eae0caa09 Add missing imports 2020-05-05 22:39:16 +02:00
Matthias Kuhn
a7e0831dcf Code style 2020-05-05 22:38:37 +02:00
José de Paula Rodrigues Neto Assis
304a3d9509 Comment clarifying query against pg_catalog 2020-04-26 15:02:43 -03:00
José de Paula Rodrigues Neto Assis
689bcc6020 Handle CONSTRAINT TRIGGER on DB Manager/PostgreSQL.
Fixes #35967
2020-04-24 11:27:43 -03:00
Alexander Bruy
88a9bea48a add missed comma 2020-04-20 09:34:26 +03:00
Alexander Bruy
9a6b0f58f5 [dbmanager] syntax highlighting for PostGIS raster fucntions (fix #16010) 2020-04-20 09:28:17 +10:00
Sandro Santilli
b2af13bdcc [DBManager] Use ST_EstimatedExtent with newer PostGIS
Avoids errors with PostGIS 3.0+ ("st_estimated_extent" does not exist
anymore with that version).
2020-03-17 20:36:13 +01:00
Even Rouault
ab1755c6a2
Merge pull request #34795 from jgrocha/fix-db-manager-extent-to-string
Fix TypeError when displaying Postgis layers extent
2020-03-11 19:45:02 +01:00
Raul Bezerra Barbosa
7fe174266d fixes #34774 - python 2to3 related bug 2020-03-11 18:09:38 +01:00
Alessandro Pasotti
d3649a51b4 DB manager: connections refresh
Fixes #34862
2020-03-05 18:09:29 +01:00
Jorge Gustavo Rocha
c5c7427a94 Display extent properly if query returns a list of values 2020-03-01 02:16:26 +00:00
Juergen E. Fischer
edee4a3d10 spelling fixes (closes #32408) 2020-02-28 21:04:02 +01:00
Corentin.F
d87843c2c3
Correct bug from postgres comment using quote or caps 2020-02-28 08:36:58 +10:00
Alessandro Pasotti
949efbd84e DB Manager: fix tests and minor cleanup 2020-01-31 13:35:29 +01:00
Alessandro Pasotti
a6e9050453 DB manager PG connection proper API usage
Fixes #34132
2020-01-31 10:47:28 +01:00
Nyall Dawson
d2dec2f823 Update test 2020-01-28 12:04:39 +10:00
Sandro Santilli
d39b6ac77d
Merge pull request #33225 from strk/dbmanager-reconnect-button
DBManager PostgreSQL backend using core APIs instead of psycopg2
2020-01-20 12:05:22 +01:00
Sandro Santilli
5b4e581d03 Remove debugging 2020-01-14 10:42:56 +01:00
Sandro Santilli
6a20ed41a7 Extract field type from QgsField 2020-01-14 10:39:31 +01:00