Fix similar_escape() to convert parentheses to non-capturing style. This is needed to avoid unwanted interference with SUBSTRING behavior, as per bug #5257 from Roman Kononov.  Also, add some basic intelligence about character classes (bracket expressions) since we now have several behaviors that aren't appropriate inside a character class.
Fix similar_escape() to convert parentheses to non-capturing style.
This is needed to avoid unwanted interference with SUBSTRING behavior,
as per bug #5257 from Roman Kononov.  Also, add some basic intelligence
about character classes (bracket expressions) since we now have several
behaviors that aren't appropriate inside a character class.

As with the previous patch in this area, I'm reluctant to back-patch
since it might affect applications that are relying on the prior
behavior.

zeroae/postgres-xl,oberstet/postgres-xl,ashwinstar/gpdb,Postgres-XL/Postgres-XL,kmjungersen/PostgresXL,50wu/gpdb,postmind-net/postgres-xl,yazun/postgres-xl,adam8157/gpdb,pavanvd/postgres-xl,yazun/postgres-xl,snaga/postgres-xl,Postgres-XL/Postgres-XL,lisakowen/gpdb,jmcatamney/gpdb,yazun/postgres-xl,adam8157/gpdb,tpostgres-projects/tPostgres,lisakowen/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,lisakowen/gpdb,arcivanov/postgres-xl,ashwinstar/gpdb,arcivanov/postgres-xl,postmind-net/postgres-xl,jmcatamney/gpdb,ovr/postgres-xl,ovr/postgres-xl,snaga/postgres-xl,yazun/postgres-xl,greenplum-db/gpdb,arcivanov/postgres-xl,50wu/gpdb,Postgres-XL/Postgres-XL,ovr/postgres-xl,postmind-net/postgres-xl,adam8157/gpdb,lisakowen/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,techdragon/Postgres-XL,arcivanov/postgres-xl,tpostgres-projects/tPostgres,postmind-net/postgres-xl,oberstet/postgres-xl,Postgres-XL/Postgres-XL,jmcatamney/gpdb,jmcatamney/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,50wu/gpdb,ovr/postgres-xl,postmind-net/postgres-xl,lisakowen/gpdb,xinzweb/gpdb,zeroae/postgres-xl,pavanvd/postgres-xl,greenplum-db/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,jmcatamney/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,lisakowen/gpdb,zeroae/postgres-xl,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,kmjungersen/PostgresXL,oberstet/postgres-xl,pavanvd/postgres-xl,greenplum-db/gpdb,oberstet/postgres-xl,adam8157/gpdb,arcivanov/postgres-xl,lisakowen/gpdb,ashwinstar/gpdb,xinzweb/gpdb,xinzweb/gpdb,50wu/gpdb,snaga/postgres-xl,xinzweb/gpdb,snaga/postgres-xl,ashwinstar/gpdb,ashwinstar/gpdb,techdragon/Postgres-XL,yazun/postgres-xl,snaga/postgres-xl,kmjungersen/PostgresXL,kmjungersen/PostgresXL,greenplum-db/gpdb,jmcatamney/gpdb,tpostgres-projects/tPostgres,zeroae/postgres-xl,greenplum-db/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,arcivanov/postgres-xl,ovr/postgres-xl,ashwinstar/gpdb,kmjungersen/PostgresXL,50wu/gpdb,pavanvd/postgres-xl,oberstet/postgres-xl,adam8157/gpdb,xinzweb/gpdb,50wu/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,50wu/gpdb