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 Server issue listing table names #5816

Closed
rotunomp opened this issue Nov 9, 2022 · 4 comments · Fixed by #6072
Closed

SQL Server issue listing table names #5816

rotunomp opened this issue Nov 9, 2022 · 4 comments · Fixed by #6072

Comments

@rotunomp
Copy link

rotunomp commented Nov 9, 2022

Bug Report

Hello, I was trying to get database table names from an SQL Server 2019 connection, and ran into this error:

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

I attempted this on a different postgres connection just to make sure, and it could properly get table names on that connection.

Q A
Version 3.5.1

How to reproduce

  • PHP Version 8.1.9
  • SQL Server 2019

This is my code. I am using Laravel to establish the DB connection, I attempted:

<?php

namespace App\Console\Commands\Run;

use App\Models\Account;
use Illuminate\Support\Facades\DB;

class TestCommand extends \Illuminate\Console\Command
{
    protected $signature = 'run:test';

    public function handle()
    {
        $connection = DB::getDoctrineConnection();
        $dbal = $connection->createSchemaManager();
        $dbal->listTableNames();
    }
}
@derrabus
Copy link
Member

derrabus commented Nov 9, 2022

Please reproduce your issue with DBAL APIs only or by providing a failing functional test. This makes it easier for others to pick your issue up because not everyone uses Laravel.

@ahmed-bhs
Copy link

@rotunomp hi, I'm facing the same issue did you find any solutions please ?

@derrabus derrabus linked a pull request Jun 28, 2023 that will close this issue
@derrabus
Copy link
Member

Does #6072 fix the issue for you?

derrabus added a commit that referenced this issue Jun 28, 2023
|      Q       |   A
|------------- | -----------
| Type         | bug
| Fixed issues | #5816

#### Summary

`SQLServerSchemaManager::selectTableNames()` binds a parameter that does
not exist in the query. I don't know how we can make the CI catch this
issue. This piece is covered by a test that fails on my machine, but
apparently the SQL Server and driver setup that I use locally is more
picky about extra parameter than the one we use on GitHub actions. 🤷🏻
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants