error when table namespace (schema) contains a hyphen (-) #4932

Closed
opened 2026-01-22 14:52:47 +01:00 by admin · 5 comments
Owner

Originally created by @kolesar-andras on GitHub (Dec 11, 2015).

Originally assigned to: @Ocramius on GitHub.

I build Laravel project, test environment had schema was named "web-test" in postgresql. I have set database search_path to "web-test", everything worked in Laravel except changing column definitions. Migration code contains this line:

$table->text('notes')->nullable()->change();

Migration gives error:

[Doctrine\DBAL\Schema\SchemaException]   
There is no column with name 'notes' on table 'reports'.

There is a column named notes in the table. I have checked Doctrine\DBAL\Schema\Table why does it throw Doctrine\DBAL\Schema\SchemaException. Dumped $_columns property in method hasColumn but it was an empty array.

I have changed schema name to "webtest" and renaming column worked.

Originally created by @kolesar-andras on GitHub (Dec 11, 2015). Originally assigned to: @Ocramius on GitHub. I build Laravel project, test environment had schema was named "web-test" in postgresql. I have set database search_path to "web-test", everything worked in Laravel except changing column definitions. Migration code contains this line: ``` $table->text('notes')->nullable()->change(); ``` Migration gives error: ``` [Doctrine\DBAL\Schema\SchemaException] There is no column with name 'notes' on table 'reports'. ``` There is a column named notes in the table. I have checked Doctrine\DBAL\Schema\Table why does it throw Doctrine\DBAL\Schema\SchemaException. Dumped $_columns property in method hasColumn but it was an empty array. I have changed schema name to "webtest" and renaming column worked.
admin added the BugInvalidMissing Tests labels 2026-01-22 14:52:47 +01:00
admin closed this issue 2026-01-22 14:52:47 +01:00
Author
Owner

@Ocramius commented on GitHub (Dec 11, 2015):

I don't see web-test in any of the examples above.

A few questions:

  • is this an actual ORM bug? Are you using the ORM or just DBAL?
  • can this be reproduced with just the DBAL test suite?
@Ocramius commented on GitHub (Dec 11, 2015): I don't see `web-test` in any of the examples above. A few questions: - is this an actual ORM bug? Are you using the ORM or just DBAL? - can this be reproduced with just the DBAL test suite?
Author
Owner

@kolesar-andras commented on GitHub (Dec 11, 2015):

Schema name "web-test" does not appear in the code because it comes from environment variable. It is also not visible in the error messages because DBAL gets only the table name "reports" without schema.

Laravel uses only DBAL, now I found https://github.com/doctrine/dbal repository, I think this issue should be reported there. Agree?

@kolesar-andras commented on GitHub (Dec 11, 2015): Schema name "web-test" does not appear in the code because it comes from environment variable. It is also not visible in the error messages because DBAL gets only the table name "reports" without schema. Laravel uses only DBAL, now I found https://github.com/doctrine/dbal repository, I think this issue should be reported there. Agree?
Author
Owner

@Ocramius commented on GitHub (Dec 11, 2015):

Yes, but we need more details on how to reproduce it outside the context of laravel.

Closing here meanwhile.

@Ocramius commented on GitHub (Dec 11, 2015): Yes, but we need more details on how to reproduce it _outside_ the context of laravel. Closing here meanwhile.
Author
Owner

@kolesar-andras commented on GitHub (Dec 12, 2015):

I have made tests in DBAL, localized the problem, made a solution that satisfies tests and created a pull request.

@kolesar-andras commented on GitHub (Dec 12, 2015): I have made tests in DBAL, localized the problem, made a solution that satisfies tests and created a pull request.
Author
Owner

@Ocramius commented on GitHub (Dec 13, 2015):

@kolesar-andras thanks!

@Ocramius commented on GitHub (Dec 13, 2015): @kolesar-andras thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4932