function PostgreSqlSequenceUpdateTest::getSequenceOwner
Same name in other branches
- 10 core/modules/pgsql/tests/src/Functional/Database/PostgreSqlSequenceUpdateTest.php \Drupal\Tests\pgsql\Functional\Database\PostgreSqlSequenceUpdateTest::getSequenceOwner()
Retrieves the sequence owner object.
Return value
object|bool Returns the sequence owner object or bool if it does not exist.
1 call to PostgreSqlSequenceUpdateTest::getSequenceOwner()
- PostgreSqlSequenceUpdateTest::testPostgreSqlSequenceUpdate in core/
modules/ pgsql/ tests/ src/ Functional/ Database/ PostgreSqlSequenceUpdateTest.php - Asserts that a newly created sequence has the correct ownership.
File
-
core/
modules/ pgsql/ tests/ src/ Functional/ Database/ PostgreSqlSequenceUpdateTest.php, line 70
Class
- PostgreSqlSequenceUpdateTest
- Tests that any unowned sequences created previously have a table owner.
Namespace
Drupal\Tests\pgsql\Functional\DatabaseCode
protected function getSequenceOwner(string $table, string $field) : object|bool {
$update_sequence = \Drupal::classResolver(Update10101::class);
$seq_name = $update_sequence->getSequenceName($table, $field);
return \Drupal::database()->query("SELECT d.refobjid::regclass as table_name, a.attname as field_name\n FROM pg_depend d\n JOIN pg_attribute a ON a.attrelid = d.refobjid AND a.attnum = d.refobjsubid\n WHERE d.objid = :seq_name::regclass\n AND d.refobjsubid > 0\n AND d.classid = 'pg_class'::regclass", [
':seq_name' => $seq_name,
])
->fetchObject();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.