Hi there,
I'm trying to run the following query, on OACS layer, whether using POSIX-style RE or SIMILAR TO RE, to match string patterns, however it sill returns the error below.
1) POSIX-style RE
db_0or1row select_revision "SELECT cr.title,
MAX(o.creation_date) AS creation_date, COUNT(*) AS occurency
FROM cr_items ci, cr_revisionsx cr, acs_objects o
WHERE ci.item_id = cr.item_id
AND ci.item_id = o.object_id AND ci.content_type = 'qt_vehicle'
AND cr.title !~ '^[0-9]'
AND cr.title NOT IN ('UNKNOWN', 'FBF724','FBF124')
GROUP BY cr.title HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC ;" -column_array revisions
2) or SIMILAR TO RE
db_0or1row select_revision "SELECT cr.title,
MAX(o.creation_date) AS creation_date, COUNT(*) AS occurency
FROM cr_items ci, cr_revisionsx cr, acs_objects o
WHERE ci.item_id = cr.item_id
AND ci.item_id = o.object_id AND ci.content_type = 'qt_vehicle'
AND cr.title NOT SIMILAR TO '^[0-9]'
AND cr.title NOT IN ('UNKNOWN', 'FBF724','FBF124')
GROUP BY cr.title HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC ;" -column_array revisions
p.s. The very same query runs just fine in the PSQL prompt command line.
title | creation_date | occurency
--------+------------------------+-----------
111111 | 2020-09-18 17:21:31+00 | 1340
849500 | 2020-09-18 14:49:04+00 | 165
411111 | 2020-09-18 16:53:23+00 | 120
311111 | 2020-09-18 16:47:35+00 | 54
333333 | 2020-09-18 14:19:34+00 | 50
502246 | 2020-08-14 13:29:39+00 | 29
502106 | 2020-08-13 10:07:24+00 | 28
365507 | 2020-08-10 18:16:22+00 | 25
900763 | 2020-09-01 10:21:08+00 | 22
211111 | 2020-09-15 11:07:17+00 | 21
895030 | 2020-09-17 10:15:28+00 | 20
184950 | 2020-09-18 14:38:22+00 | 17
Is there any change to how we write PGSQL queries using regular expression in POSIX-style or SIMILAR TO ?
Best wishes,
I
Reference:
https://www.postgresql.org/docs/9.3/functions-matching.html
ERROR LOG
[18/Sep/2020:19:03:12][18107.7efbf3d70700][-conn:qonteo:default:0:121-] Error: invalid command name "0-9"
: while executing
: "0-9"
: ("uplevel" body line 92)
: invoked from within
: "uplevel {
: ad_page_contract {
: @author Neophytos Demetriou <k2pts@cytanet.com.cy>
: @creation-date September 01, 2001
: @cvs-id $Id: search...."
: (procedure "code::tcl::/var/www/qonteo/oacs//packages/qt-rest/www/search" line 2)
: invoked from within
: "code::tcl::$__adp_stub"
: ("uplevel" body line 12)
: invoked from within
: "uplevel {
:
: if { [file exists $__adp_stub.tcl] } {
:
: # ensure that data source preparation procedure exists and is up-to-date
: ..."
: (procedure "adp_prepare" line 2)
: invoked from within
: "adp_prepare"
: invoked from within
: "template::adp_parse $themed_template {}"
: (procedure "adp_parse_ad_conn_file" line 14)
: invoked from within
: "$handler"
: ("uplevel" body line 2)
: invoked from within
: "uplevel $code"
: invoked from within
: "ad_try {
: $handler
: } ad_script_abort val {
: # do nothing
: }"
: invoked from within
: "rp_serve_concrete_file [ad_conn file]"
: (procedure "::nsf::procs::rp_serve_abstract_file" line 60)
: invoked from within
: "rp_serve_abstract_file "$root/$extra_url""
: ("uplevel" body line 2)
: invoked from within
: "uplevel $code"
: invoked from within