diff --git a/appveyor.yml b/appveyor.yml index b9ced9ea7f12..6be20ecd9540 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,14 +6,23 @@ platform: environment: PGUSER: "postgres" PGPASSWORD: "Password12!" + PGPORT: 5432 + PGHOST: "localhost" + IBIS_TEST_DOWNLOAD_DIRECTORY: "%USERPROFILE%" IBIS_TEST_DOWNLOAD_BASE_URL: "https://storage.googleapis.com/ibis-ci-data" IBIS_TEST_DOWNLOAD_NAME: "ibis-testing-data.tar.gz" + IBIS_TEST_DATA_DIRECTORY: "%USERPROFILE%\\ibis-testing-data" + IBIS_TEST_POSTGRES_USER: "%PGUSER%" IBIS_TEST_POSTGRES_PASSWORD: "%PGPASSWORD%" + IBIS_TEST_POSTGRES_PORT: "%PGPORT%" + IBIS_TEST_POSTGRES_HOST: "%PGHOST%" IBIS_TEST_POSTGRES_DATABASE: "ibis_testing" + IBIS_TEST_SQLITE_DATABASE: "%USERPROFILE%\\ibis_testing.db" + CONDA: "C:\\Miniconda36-x64\\Scripts\\conda" ACTIVATE: "C:\\Miniconda36-x64\\Scripts\\activate" @@ -24,9 +33,11 @@ environment: - PYTHON_VERSION: "3.6" services: - - postgresql93 + - postgresql10 test_script: + - "net start postgresql-x64-10" # workaround until https://help.appveyor.com/discussions/problems/11031-postgresql-10-service-not-starting is resolved + - "\"C:\\Program Files\\PostgreSQL\\10\\bin\\psql\" -c \"SELECT VERSION()\"" - "%CONDA% --version" - "%CONDA% config --set always_yes true" - "%CONDA% install conda=4.3.22 --channel conda-forge" diff --git a/ibis/sql/postgres/compiler.py b/ibis/sql/postgres/compiler.py index 29acf9b90a30..1ebe16bad7b7 100644 --- a/ibis/sql/postgres/compiler.py +++ b/ibis/sql/postgres/compiler.py @@ -444,11 +444,12 @@ def __init__(self, string, pattern, index): @compiles(regex_extract, 'postgresql') def compile_regex_extract(element, compiler, **kw): - return '(REGEXP_MATCHES(%s, %s))[%s]' % ( + result = '(SELECT * FROM REGEXP_MATCHES({}, {}))[{}]'.format( compiler.process(element.string, **kw), compiler.process(element.pattern, **kw), compiler.process(element.index, **kw), ) + return result def _regex_extract(t, expr): diff --git a/ibis/sql/postgres/tests/conftest.py b/ibis/sql/postgres/tests/conftest.py index 5c8560a0a641..39bdf225c6fb 100644 --- a/ibis/sql/postgres/tests/conftest.py +++ b/ibis/sql/postgres/tests/conftest.py @@ -30,6 +30,10 @@ 'IBIS_TEST_POSTGRES_HOST', os.environ.get('PGHOST', 'localhost') ) +PG_PORT = os.environ.get( + 'IBIS_TEST_POSTGRES_PORT', + os.environ.get('PGPORT', 5432) +) IBIS_TEST_POSTGRES_DB = os.environ.get( 'IBIS_TEST_POSTGRES_DATABASE', os.environ.get('PGDATABASE', 'ibis_testing') @@ -43,6 +47,7 @@ def con(): user=PG_USER, password=PG_PASS, database=IBIS_TEST_POSTGRES_DB, + port=PG_PORT, )