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 in \yii\db\Schema (return syntax error on sql with plv8) #17329

Closed
halfmike opened this issue May 29, 2019 · 1 comment
Closed

Bug in \yii\db\Schema (return syntax error on sql with plv8) #17329

halfmike opened this issue May 29, 2019 · 1 comment
Labels
PostgreSQL status:to be verified Needs to be reproduced and validated.

Comments

@halfmike
Copy link

halfmike commented May 29, 2019

What steps will reproduce the problem?

I try execute a query with plv8 extension syntax(Postgresql)
If i do it with PDO - all good
If i do it with \yii\db\Connection - getting error

$sql = 
CREATE OR REPLACE FUNCTION public.test() RETURNS numeric
LANGUAGE plv8
AS $_$
{
let param = 1;
let param2 = 1 ? 2 : 0;
return 1;
}
$_$;

Error just on operator "? : "

->createCommand($sql)->execute()

What is the expected result?

all done

What do you get instead?

SQLSTATE[XX000]: Internal error: 7 ERROR:  SyntaxError: Unexpected identifier
in /srv/api2/vendor/yiisoft/yii2/db/Schema.php:664

Error Info:
Array
(
    [0] => XX000
    [1] => 7
    [2] => ERROR:  SyntaxError: Unexpected identifier
CONTEXT:  test() LINE 4:  	let param2 = 1 $1 2 : 0;
}
Q A
Yii version 2.0.15.1
PHP version 5.6.40
Operating system ubuntu18.10.1
@samdark samdark added PostgreSQL status:to be verified Needs to be reproduced and validated. labels May 29, 2019
@samdark
Copy link
Member

samdark commented May 29, 2019

When executing with PDO, have you done it like the following?

Yii::$app->db->pdo->exec('YOUR_SQL_HERE')

?

@mtangoo mtangoo closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PostgreSQL status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests

3 participants