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

SQL error "operator does not exist: boolean = integer" with Postgres #1511

Closed
allantatter opened this issue Aug 26, 2024 · 3 comments
Closed

Comments

@allantatter
Copy link

Telescope Version

5.2.1

Laravel Version

11.21.0

PHP Version

8.2.21

Database Driver & Version

psql (PostgreSQL) 14.12 (Homebrew)

Description

Telescope views do not load with Postgres as a database driver. Tested with different Postges versions: 14 and 16.

SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer
LINE 1: ... "type" = 'command' and "should_display_on_index" = 1 order ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts. (Connection: pgsql, SQL: select * from "telescope_entries" where "type" = command and "should_display_on_index" = 1 order by "sequence" desc limit 50) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42883): SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer

Steps To Reproduce

Fresh Laravel and Laravel Telescope install with Postgres.

@laravel laravel deleted a comment Aug 26, 2024
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@hafezdivandari
Copy link

hafezdivandari commented Sep 17, 2024

Please add the following lines to config\database.php file and let me know the result:

'connections' => [
    //...

    'pgsql' => [
        //...
        'sslmode' => 'prefer',
+       'options' => [
+           PDO::ATTR_EMULATE_PREPARES => false,
+       ],
    ],
],

@allantatter
Copy link
Author

allantatter commented Sep 18, 2024

@hafezdivandari I needed to have emulate prepares as true for other parts of the application to work. I found a workaround to put change the emulate prepares config dynamically within TelescopeProvider's register() method:

if ($this->app->request->is('telescope/*')) {
    Config::set('database.connections.pgsql.options.' . PDO::ATTR_EMULATE_PREPARES, false);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@allantatter @driesvints @hafezdivandari and others