@@ -99,13 +99,13 @@ def getSource(self):
99
99
# create temporary table for edit tests
100
100
self .execSQLCommand ('DROP TABLE IF EXISTS qgis_test."editData" CASCADE' )
101
101
self .execSQLCommand (
102
- 'CREATE TABLE qgis_test."editData" ( pk SERIAL NOT NULL PRIMARY KEY, cnt integer, name text, name2 text, num_char text, geom public.geometry(Point, 4326))' )
103
- self .execSQLCommand ("INSERT INTO qgis_test.\" editData\" (pk, cnt, name, name2, num_char, geom) VALUES "
104
- "(5, -200, NULL, 'NuLl', '5', '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),"
105
- "(3, 300, 'Pear', 'PEaR', '3', NULL),"
106
- "(1, 100, 'Orange', 'oranGe', '1', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),"
107
- "(2, 200, 'Apple', 'Apple', '2', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),"
108
- "(4, 400, 'Honey', 'Honey', '4', '0101000020E610000014AE47E17A5450C03333333333935340')" )
102
+ 'CREATE TABLE qgis_test."editData" ( pk SERIAL NOT NULL PRIMARY KEY, cnt integer, name text, name2 text, num_char text, dt timestamp without time zone, "date" date, "time" time without time zone, geom public.geometry(Point, 4326))' )
103
+ self .execSQLCommand ("INSERT INTO qgis_test.\" editData\" (pk, cnt, name, name2, num_char, dt, \" date \" , \" time \" , geom) VALUES "
104
+ "(5, -200, NULL, 'NuLl', '5', TIMESTAMP '2020-05-04 12:13:14', '2020-05-02', '12:13:01', '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),"
105
+ "(3, 300, 'Pear', 'PEaR', '3', NULL, NULL, NULL, NULL ),"
106
+ "(1, 100, 'Orange', 'oranGe', '1', TIMESTAMP '2020-05-03 12:13:14', '2020-05-03', '12:13:14', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),"
107
+ "(2, 200, 'Apple', 'Apple', '2', TIMESTAMP '2020-05-04 12:14:14', '2020-05-04', '12:14:14', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),"
108
+ "(4, 400, 'Honey', 'Honey', '4', TIMESTAMP '2021-05-04 13:13:14', '2021-05-04', '13:13:14', '0101000020E610000014AE47E17A5450C03333333333935340')" )
109
109
vl = QgsVectorLayer (
110
110
self .dbconn + ' sslmode=disable key=\' pk\' srid=4326 type=POINT table="qgis_test"."editData" (geom) sql=' ,
111
111
'test' , 'postgres' )
@@ -122,7 +122,14 @@ def disableCompiler(self):
122
122
QgsSettings ().setValue ('/qgis/compileExpressions' , False )
123
123
124
124
def uncompiledFilters (self ):
125
- return set ([])
125
+ return set (['"dt" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
126
+ '"dt" < make_date(2020, 5, 4)' ,
127
+ '"dt" = to_datetime(\' 000www14ww13ww12www4ww5ww2020\' ,\' zzzwwwsswwmmwwhhwwwdwwMwwyyyy\' )' ,
128
+ '"date" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
129
+ '"date" >= make_date(2020, 5, 4)' ,
130
+ '"date" = to_date(\' www4ww5ww2020\' ,\' wwwdwwMwwyyyy\' )' ,
131
+ '"time" >= make_time(12, 14, 14)' ,
132
+ '"time" = to_time(\' 000www14ww13ww12www\' ,\' zzzwwwsswwmmwwhhwww\' )' ])
126
133
127
134
def partiallyCompiledFilters (self ):
128
135
return set ([])
@@ -1126,16 +1133,16 @@ def testVectorLayerUtilsCreateFeatureWithProviderDefault(self):
1126
1133
# See https://github.com/qgis/QGIS/issues/27758
1127
1134
f = QgsVectorLayerUtils .createFeature (vl , attributes = {1 : 5 , 3 : 'map' })
1128
1135
# changed so that createFeature respects user choice
1129
- self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'map' , None , None ])
1136
+ self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'map' , None , None , None , None , None ])
1130
1137
1131
1138
vl .setDefaultValueDefinition (3 , QgsDefaultValue ("'mappy'" ))
1132
1139
# test ignore vector layer default value expression overrides postgres provider default clause,
1133
1140
# due to user's choice
1134
1141
f = QgsVectorLayerUtils .createFeature (vl , attributes = {1 : 5 , 3 : 'map' })
1135
- self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'map' , None , None ])
1142
+ self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'map' , None , None , None , None , None ])
1136
1143
# Since user did not enter a default for field 3, test must return the default value chosen
1137
1144
f = QgsVectorLayerUtils .createFeature (vl , attributes = {1 : 5 })
1138
- self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'mappy' , None , None ])
1145
+ self .assertEqual (f .attributes (), [default_clause , 5 , "'qgis'::text" , 'mappy' , None , None , None , None , None ])
1139
1146
1140
1147
# See https://github.com/qgis/QGIS/issues/23127
1141
1148
def testNumericPrecision (self ):
@@ -1909,7 +1916,14 @@ def disableCompiler(self):
1909
1916
QgsSettings ().setValue ('/qgis/compileExpressions' , False )
1910
1917
1911
1918
def uncompiledFilters (self ):
1912
- return set ([])
1919
+ return set (['"dt" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
1920
+ '"dt" < make_date(2020, 5, 4)' ,
1921
+ '"dt" = to_datetime(\' 000www14ww13ww12www4ww5ww2020\' ,\' zzzwwwsswwmmwwhhwwwdwwMwwyyyy\' )' ,
1922
+ '"date" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
1923
+ '"date" >= make_date(2020, 5, 4)' ,
1924
+ '"date" = to_date(\' www4ww5ww2020\' ,\' wwwdwwMwwyyyy\' )' ,
1925
+ '"time" >= make_time(12, 14, 14)' ,
1926
+ '"time" = to_time(\' 000www14ww13ww12www\' ,\' zzzwwwsswwmmwwhhwww\' )' ])
1913
1927
1914
1928
def partiallyCompiledFilters (self ):
1915
1929
return set ([])
@@ -1945,14 +1959,14 @@ def getSource(self):
1945
1959
""" drops/recreates the test data anew, like TestPyQgsPostgresProvider::getSource above. """
1946
1960
self .execSqlCommand ("DROP TABLE IF EXISTS qgis_test.provider_edit_bigint_single_pk" )
1947
1961
self .execSqlCommand (
1948
- "CREATE TABLE qgis_test.provider_edit_bigint_single_pk ( pk bigserial PRIMARY KEY, cnt integer, name text DEFAULT 'qgis', name2 text DEFAULT 'qgis', num_char text, geom public.geometry(Point,4326), key1 integer, key2 integer)" )
1962
+ "CREATE TABLE qgis_test.provider_edit_bigint_single_pk ( pk bigserial PRIMARY KEY, cnt integer, name text DEFAULT 'qgis', name2 text DEFAULT 'qgis', num_char text, dt timestamp without time zone, \" date \" date, \" time \" time without time zone, geom public.geometry(Point,4326), key1 integer, key2 integer)" )
1949
1963
self .execSqlCommand (
1950
- "INSERT INTO qgis_test.provider_edit_bigint_single_pk ( key1, key2, pk, cnt, name, name2, num_char, geom) VALUES"
1951
- "(1, 1, 5, -200, NULL, 'NuLl', '5', '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),"
1952
- "(1, 2, 3, 300, 'Pear', 'PEaR', '3', NULL),"
1953
- "(2, 1, 1, 100, 'Orange', 'oranGe', '1', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),"
1954
- "(2, 2, 2, 200, 'Apple', 'Apple', '2', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),"
1955
- "(2, 3, 4, 400, 'Honey', 'Honey', '4', '0101000020E610000014AE47E17A5450C03333333333935340')" )
1964
+ "INSERT INTO qgis_test.provider_edit_bigint_single_pk ( key1, key2, pk, cnt, name, name2, num_char, dt, \" date \" , \" time \" , geom) VALUES"
1965
+ "(1, 1, 5, -200, NULL, 'NuLl', '5', TIMESTAMP '2020-05-04 12:13:14', '2020-05-02', '12:13:01', '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),"
1966
+ "(1, 2, 3, 300, 'Pear', 'PEaR', '3', NULL, NULL, NULL, NULL ),"
1967
+ "(2, 1, 1, 100, 'Orange', 'oranGe', '1', TIMESTAMP '2020-05-03 12:13:14', '2020-05-03', '12:13:14', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),"
1968
+ "(2, 2, 2, 200, 'Apple', 'Apple', '2', TIMESTAMP '2020-05-04 12:14:14', '2020-05-04', '12:14:14', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),"
1969
+ "(2, 3, 4, 400, 'Honey', 'Honey', '4', TIMESTAMP '2021-05-04 13:13:14', '2021-05-04', '13:13:14', '0101000020E610000014AE47E17A5450C03333333333935340')" )
1956
1970
vl = QgsVectorLayer (
1957
1971
self .dbconn + ' sslmode=disable key=\' "pk"\' srid=4326 type=POINT table="qgis_test"."provider_edit_bigint_single_pk" (geom) sql=' ,
1958
1972
'edit_bigint_pk' , 'postgres' )
@@ -1977,7 +1991,14 @@ def disableCompiler(self):
1977
1991
QgsSettings ().setValue ('/qgis/compileExpressions' , False )
1978
1992
1979
1993
def uncompiledFilters (self ):
1980
- return set ([])
1994
+ return set (['"dt" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
1995
+ '"dt" < make_date(2020, 5, 4)' ,
1996
+ '"dt" = to_datetime(\' 000www14ww13ww12www4ww5ww2020\' ,\' zzzwwwsswwmmwwhhwwwdwwMwwyyyy\' )' ,
1997
+ '"date" <= make_datetime(2020, 5, 4, 12, 13, 14)' ,
1998
+ '"date" >= make_date(2020, 5, 4)' ,
1999
+ '"date" = to_date(\' www4ww5ww2020\' ,\' wwwdwwMwwyyyy\' )' ,
2000
+ '"time" >= make_time(12, 14, 14)' ,
2001
+ '"time" = to_time(\' 000www14ww13ww12www\' ,\' zzzwwwsswwmmwwhhwww\' )' ])
1981
2002
1982
2003
def partiallyCompiledFilters (self ):
1983
2004
return set ([])
0 commit comments