Skip to content

Commit c0cbd20

Browse files
committed
fix: ci/cd workflow
1 parent ae32fa9 commit c0cbd20

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

.github/workflows/job-pg-query-extension.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,11 @@ jobs:
3535
brew install autoconf automake libtool protobuf protobuf-c
3636
3737
- name: Build libpg_query and extension
38-
working-directory: src/extension/pg-query-parser
38+
working-directory: src/extension/pg-query-ext
3939
run: |
4040
make clean || true
4141
make build
4242
4343
- name: Run extension tests
44-
working-directory: src/extension/pg-query-parser
44+
working-directory: src/extension/pg-query-ext
4545
run: make test
46-
47-
- name: Install composer dependencies
48-
working-directory: src/extension/pg-query-parser
49-
run: composer install --no-interaction
50-
51-
- name: Run PHP tests
52-
working-directory: src/extension/pg-query-parser
53-
run: php -d extension=./ext/modules/pg_query.so vendor/bin/phpunit

src/extension/pg-query-ext/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ make install
8181
From the Flow PHP monorepo root:
8282

8383
```bash
84-
# Enter Nix shell with build tools
85-
nix-shell --arg with-pg-query-build-tools true
84+
# Enter Nix shell with pg_query extension loaded and build tools available
85+
nix-shell --arg with-pg-query-ext true
8686

8787
# Navigate to extension directory
8888
cd src/extension/pg-query-ext

src/extension/pg-query-ext/ext/pg_query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PHP_MINFO_FUNCTION(pg_query)
7171
php_info_print_table_start();
7272
php_info_print_table_header(2, "pg_query support", "enabled");
7373
php_info_print_table_row(2, "Version", PHP_PG_QUERY_VERSION);
74-
php_info_print_table_row(2, "libpg_query version", "16-5.1.0");
74+
php_info_print_table_row(2, "libpg_query version", "17-6.1.0");
7575
php_info_print_table_end();
7676
}
7777

src/lib/pg-query/src/Flow/PgQuery/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function parse(string $sql) : ParseResult
3535
try {
3636
$json = pg_query_parse($sql);
3737
} catch (\RuntimeException $e) {
38-
throw new ParserException($e->getMessage());
38+
throw new ParserException($e->getMessage(), $e->getCode() ?: null);
3939
}
4040

4141
$result = new ParseResult();

src/lib/pg-query/tests/Flow/PgQuery/Tests/Unit/ParserTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,32 @@ public function test_normalize_multiple_values() : void
5555
self::assertStringContainsString('$2', $normalized);
5656
}
5757

58+
public function test_parse_exception_contains_cursor_position() : void
59+
{
60+
$parser = new Parser();
61+
62+
try {
63+
$parser->parse('SELECT * FROM');
64+
} catch (\Flow\PgQuery\Exception\ParserException $e) {
65+
self::assertNotNull($e->cursorPosition);
66+
self::assertGreaterThan(0, $e->cursorPosition);
67+
68+
return;
69+
}
70+
71+
self::fail('Expected ParserException was not thrown');
72+
}
73+
74+
public function test_parse_invalid_sql_throws_exception() : void
75+
{
76+
$parser = new Parser();
77+
78+
$this->expectException(\Flow\PgQuery\Exception\ParserException::class);
79+
$this->expectExceptionMessage('syntax error');
80+
81+
$parser->parse('SELECT FROM WHERE');
82+
}
83+
5884
public function test_parse_multiple_statements() : void
5985
{
6086
$parser = new Parser();

0 commit comments

Comments
 (0)