Skip to content

Commit 6cf6dfc

Browse files
committed
Merge pull request #8394 from efecan/patch-1
[5.0] Enclose PostgreSQL schema name with double quotes
2 parents 30ae125 + b825a3c commit 6cf6dfc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Illuminate/Database/Connectors/PostgresConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function connect(array $config)
5454
{
5555
$schema = $config['schema'];
5656

57-
$connection->prepare("set search_path to {$schema}")->execute();
57+
$connection->prepare("set search_path to \"{$schema}\"")->execute();
5858
}
5959

6060
return $connection;

tests/Database/DatabaseConnectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testPostgresSearchPathIsSet()
7171
$connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(array('options')));
7272
$connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(array('options')))->will($this->returnValue($connection));
7373
$connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection);
74-
$connection->shouldReceive('prepare')->once()->with("set search_path to public")->andReturn($connection);
74+
$connection->shouldReceive('prepare')->once()->with('set search_path to "public"')->andReturn($connection);
7575
$connection->shouldReceive('execute')->twice();
7676
$result = $connector->connect($config);
7777

0 commit comments

Comments
 (0)