Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Postgres 10 failing on regex_extract #1278

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion appveyor.yml
Expand Up @@ -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"

Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion ibis/sql/postgres/compiler.py
Expand Up @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions ibis/sql/postgres/tests/conftest.py
Expand Up @@ -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')
Expand All @@ -43,6 +47,7 @@ def con():
user=PG_USER,
password=PG_PASS,
database=IBIS_TEST_POSTGRES_DB,
port=PG_PORT,
)


Expand Down