classPgSqlSchemaReflector
final class PgSqlSchemaReflector
implements SchemaReflector, ViewReflector
Fetches PostgreSQL schema information via information_schema queries.
Reconstructs CREATE TABLE statements from pg_catalog/information_schema since PostgreSQL has no SHOW CREATE TABLE equivalent.
Methods§
public function __construct(ConnectionInterface $connection)Initializes the collaborators and state used by this schema reflector.
Parameters
$connection | ConnectionInterface |
public function getCreateStatement(string $tableName): ?string{@inheritDoc}
Parameters
$tableName | string |
Returns
?stringTest cases 67
PgSqlSchemaReflectorTest::testArrayWithLowercaseUdtNamecallsPgSqlSchemaReflectorTest::testCharStringLengthcallsPgSqlSchemaReflectorTest::testCollectsCompositePartialIndexesAndDiscardsMalformedMetadatacallsPgSqlSchemaReflectorTest::testEscapesTableNameInEveryMetadataQuerycallsPgSqlSchemaReflectorTest::testExactSqlForArrayNoUnderscorecallsPgSqlSchemaReflectorTest::testExactSqlForArrayWithUnderscorecallsPgSqlSchemaReflectorTest::testExactSqlForBigintcallsPgSqlSchemaReflectorTest::testExactSqlForBooleancallsPgSqlSchemaReflectorTest::testExactSqlForByteacallsPgSqlSchemaReflectorTest::testExactSqlForCharNoLencallsPgSqlSchemaReflectorTest::testExactSqlForCharWithLencallsPgSqlSchemaReflectorTest::testExactSqlForDatecallsPgSqlSchemaReflectorTest::testExactSqlForDoublePrecisioncallsPgSqlSchemaReflectorTest::testExactSqlForIntegerNotNullcallsPgSqlSchemaReflectorTest::testExactSqlForJsoncallsPgSqlSchemaReflectorTest::testExactSqlForJsonbcallsPgSqlSchemaReflectorTest::testExactSqlForNumericBarecallsPgSqlSchemaReflectorTest::testExactSqlForNumericPrecisionOnlycallsPgSqlSchemaReflectorTest::testExactSqlForNumericPrecisionScalecallsPgSqlSchemaReflectorTest::testExactSqlForRealcallsPgSqlSchemaReflectorTest::testExactSqlForSmallintcallsPgSqlSchemaReflectorTest::testExactSqlForTextcallsPgSqlSchemaReflectorTest::testExactSqlForTimecallsPgSqlSchemaReflectorTest::testExactSqlForTimestampcallsPgSqlSchemaReflectorTest::testExactSqlForTimestamptzcallsPgSqlSchemaReflectorTest::testExactSqlForTimetzcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedCitextcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedCustomcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedEmptycallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedHstorecallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedLtreecallsPgSqlSchemaReflectorTest::testExactSqlForUuidcallsPgSqlSchemaReflectorTest::testExactSqlForVarcharNoLencallsPgSqlSchemaReflectorTest::testExactSqlForVarcharWithLencallsPgSqlSchemaReflectorTest::testExactSqlPreservesBitWidthscallsPgSqlSchemaReflectorTest::testExactSqlPreservesUnboundedBitTypescallsPgSqlSchemaReflectorTest::testExactSqlWithCompositePkcallsPgSqlSchemaReflectorTest::testExactSqlWithCompositeUniquecallsPgSqlSchemaReflectorTest::testExactSqlWithDefaultcallsPgSqlSchemaReflectorTest::testExactSqlWithPkcallsPgSqlSchemaReflectorTest::testExactSqlWithPkAndUniquecallsPgSqlSchemaReflectorTest::testExactSqlWithUniquecallsPgSqlSchemaReflectorTest::testForeignKeyQueryIsExactAndEscapesTableNamecallsPgSqlSchemaReflectorTest::testForeignKeysAreReconstructedWithCompositeColumnsAndActionscallsPgSqlSchemaReflectorTest::testGetCreateStatementReturnsNullWhenNoColumnscallsPgSqlSchemaReflectorTest::testGetCreateStatementReturnsNullWhenQueryFailscallsPgSqlSchemaReflectorTest::testMalformedForeignKeyRowsAreSkippedIndependentlycallsPgSqlSchemaReflectorTest::testMissingColumnNameDefaultscallsPgSqlSchemaReflectorTest::testMissingDataTypeDefaultsToTextcallsPgSqlSchemaReflectorTest::testNumericIntPrecisionAndScaleExactOutputcallsPgSqlSchemaReflectorTest::testNumericNonIntPrecisionCastsToIntcallsPgSqlSchemaReflectorTest::testNumericPrecisionOnlyNonIntCastsToIntcallsPgSqlSchemaReflectorTest::testNumericStringPrecisionOnlycallsPgSqlSchemaReflectorTest::testNumericStringPrecisionScalecallsPgSqlSchemaReflectorTest::testPartialUniqueIndexesReflectsPartialUniqueIndexesWithoutFlatteningTheirPredicatecallsPgSqlSchemaReflectorTest::testPkNonStringColumnNameIsSkippedcallsPgSqlSchemaReflectorTest::testPkQueryReturnsFalseStillWorkscallsPgSqlSchemaReflectorTest::testReflectsDomainWithoutSchemaAsAQuotedTypecallsPgSqlSchemaReflectorTest::testReflectsGeneratedAndIdentityColumnscallsPgSqlSchemaReflectorTest::testReflectsSchemaQualifiedDomainTypeInsteadOfItsBaseTypecallsPgSqlSchemaReflectorTest::testTableNameEscapingcallsPgSqlSchemaReflectorTest::testUniqueConstraintNonStringColumnsAreSkippedcallsPgSqlSchemaReflectorTest::testUniqueQueryReturnsFalseStillWorkscallsPgSqlSchemaReflectorTest::testUnknownDataTypePassedThroughcallsPgSqlSchemaReflectorTest::testVarcharStringLengthcallsPgSqlSchemaReflectorTest::testVerifyColumnsQueryExactcallsPgSqlSchemaReflectorTest::testVerifyPkQueryExactcalls
Called from 1
Calls 15
- new TableQueries line 41
- method-call TableQueries::columns() line 42
- method-call ColumnDefinitionSql::buildColumnDefinition() line 52
- new ColumnDefinitionSql line 52
- method-call PrimaryColumns::columns() line 54
- new PrimaryColumns line 54
- method-call TableQueries::primaryKey() line 54
- method-call UniqueIndexes::definitions() line 55
- new UniqueIndexes line 55
- method-call TableQueries::uniqueIndexes() line 55
- method-call ForeignKeys::definitions() line 57
- new ForeignKeys line 57
- method-call TableQueries::foreignKeys() line 57
- function-call
implodeline 59 - function-call
array_mergeline 61
public function reflectAll(): array{@inheritDoc}
Returns
arrayTest cases 7
PgSqlSchemaReflectorTest::testReflectAllExactResultscallsPgSqlSchemaReflectorTest::testReflectAllMultipleTablesExactResultscallsPgSqlSchemaReflectorTest::testReflectAllReturnsEmptyOnFailurecallsPgSqlSchemaReflectorTest::testReflectAllSkipsInvalidNamescallsPgSqlSchemaReflectorTest::testReflectAllSkipsTablesWithNoColumnscallsPgSqlSchemaReflectorTest::testTableNameWithSingleQuoteInReflectAllcallsPgSqlSchemaReflectorTest::testVerifyReflectAllListQuerycalls
Called from 1
Calls 3
- method-call ConnectionInterface::query() line 70
- function-call
is_stringline 84 - method-call PgSqlSchemaReflector::getCreateStatement() line 88
public function partialUniqueIndexes(): array<string, array<string, PartialUniqueIndex>>Returns
array<string, array<string, PartialUniqueIndex>>Test cases 2
public function reflectViews(): array{@inheritDoc}
Returns
arrayTest cases 2
Called from 1
Calls 5
- method-call ConnectionInterface::query() line 110
- function-call
is_stringline 121 - function-call
trimline 121 - method-call PgSqlViewDefinitionParser::fromQuery() line 124
- new PgSqlViewDefinitionParser line 124
Private surface 2§
Implementation details, listed for orientation only.
private ConnectionInterface $connectionprivate array<string, array<string, PartialUniqueIndex>> $partialUniqueIndexes = []Test cases 78§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 76
PgSqlSchemaReflectorTest::testArrayWithLowercaseUdtNamecallsPgSqlSchemaReflectorTest::testCharStringLengthcallsPgSqlSchemaReflectorTest::testCollectsCompositePartialIndexesAndDiscardsMalformedMetadatacallsPgSqlSchemaReflectorTest::testEscapesTableNameInEveryMetadataQuerycallsPgSqlSchemaReflectorTest::testExactSqlForArrayNoUnderscorecallsPgSqlSchemaReflectorTest::testExactSqlForArrayWithUnderscorecallsPgSqlSchemaReflectorTest::testExactSqlForBigintcallsPgSqlSchemaReflectorTest::testExactSqlForBooleancallsPgSqlSchemaReflectorTest::testExactSqlForByteacallsPgSqlSchemaReflectorTest::testExactSqlForCharNoLencallsPgSqlSchemaReflectorTest::testExactSqlForCharWithLencallsPgSqlSchemaReflectorTest::testExactSqlForDatecallsPgSqlSchemaReflectorTest::testExactSqlForDoublePrecisioncallsPgSqlSchemaReflectorTest::testExactSqlForIntegerNotNullcallsPgSqlSchemaReflectorTest::testExactSqlForJsoncallsPgSqlSchemaReflectorTest::testExactSqlForJsonbcallsPgSqlSchemaReflectorTest::testExactSqlForNumericBarecallsPgSqlSchemaReflectorTest::testExactSqlForNumericPrecisionOnlycallsPgSqlSchemaReflectorTest::testExactSqlForNumericPrecisionScalecallsPgSqlSchemaReflectorTest::testExactSqlForRealcallsPgSqlSchemaReflectorTest::testExactSqlForSmallintcallsPgSqlSchemaReflectorTest::testExactSqlForTextcallsPgSqlSchemaReflectorTest::testExactSqlForTimecallsPgSqlSchemaReflectorTest::testExactSqlForTimestampcallsPgSqlSchemaReflectorTest::testExactSqlForTimestamptzcallsPgSqlSchemaReflectorTest::testExactSqlForTimetzcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedCitextcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedCustomcallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedEmptycallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedHstorecallsPgSqlSchemaReflectorTest::testExactSqlForUserDefinedLtreecallsPgSqlSchemaReflectorTest::testExactSqlForUuidcallsPgSqlSchemaReflectorTest::testExactSqlForVarcharNoLencallsPgSqlSchemaReflectorTest::testExactSqlForVarcharWithLencallsPgSqlSchemaReflectorTest::testExactSqlPreservesBitWidthscallsPgSqlSchemaReflectorTest::testExactSqlPreservesUnboundedBitTypescallsPgSqlSchemaReflectorTest::testExactSqlWithCompositePkcallsPgSqlSchemaReflectorTest::testExactSqlWithCompositeUniquecallsPgSqlSchemaReflectorTest::testExactSqlWithDefaultcallsPgSqlSchemaReflectorTest::testExactSqlWithPkcallsPgSqlSchemaReflectorTest::testExactSqlWithPkAndUniquecallsPgSqlSchemaReflectorTest::testExactSqlWithUniquecallsPgSqlSchemaReflectorTest::testForeignKeyQueryIsExactAndEscapesTableNamecallsPgSqlSchemaReflectorTest::testForeignKeysAreReconstructedWithCompositeColumnsAndActionscallsPgSqlSchemaReflectorTest::testGetCreateStatementReturnsNullWhenNoColumnscallsPgSqlSchemaReflectorTest::testGetCreateStatementReturnsNullWhenQueryFailscallsPgSqlSchemaReflectorTest::testMalformedForeignKeyRowsAreSkippedIndependentlycallsPgSqlSchemaReflectorTest::testMissingColumnNameDefaultscallsPgSqlSchemaReflectorTest::testMissingDataTypeDefaultsToTextcallsPgSqlSchemaReflectorTest::testNumericIntPrecisionAndScaleExactOutputcallsPgSqlSchemaReflectorTest::testNumericNonIntPrecisionCastsToIntcallsPgSqlSchemaReflectorTest::testNumericPrecisionOnlyNonIntCastsToIntcallsPgSqlSchemaReflectorTest::testNumericStringPrecisionOnlycallsPgSqlSchemaReflectorTest::testNumericStringPrecisionScalecallsPgSqlSchemaReflectorTest::testPartialUniqueIndexesReflectsPartialUniqueIndexesWithoutFlatteningTheirPredicatecallsPgSqlSchemaReflectorTest::testPkNonStringColumnNameIsSkippedcallsPgSqlSchemaReflectorTest::testPkQueryReturnsFalseStillWorkscallsPgSqlSchemaReflectorTest::testReflectAllExactResultscallsPgSqlSchemaReflectorTest::testReflectAllMultipleTablesExactResultscallsPgSqlSchemaReflectorTest::testReflectAllReturnsEmptyOnFailurecallsPgSqlSchemaReflectorTest::testReflectAllSkipsInvalidNamescallsPgSqlSchemaReflectorTest::testReflectAllSkipsTablesWithNoColumnscallsPgSqlSchemaReflectorTest::testReflectsDomainWithoutSchemaAsAQuotedTypecallsPgSqlSchemaReflectorTest::testReflectsGeneratedAndIdentityColumnscallsPgSqlSchemaReflectorTest::testReflectsSchemaQualifiedDomainTypeInsteadOfItsBaseTypecallsPgSqlSchemaReflectorTest::testReflectViewsReturnsEmptyWhenQueryFailscallsPgSqlSchemaReflectorTest::testReflectViewsSkipsMalformedRowscallsPgSqlSchemaReflectorTest::testTableNameEscapingcallsPgSqlSchemaReflectorTest::testTableNameWithSingleQuoteInReflectAllcallsPgSqlSchemaReflectorTest::testUniqueConstraintNonStringColumnsAreSkippedcallsPgSqlSchemaReflectorTest::testUniqueQueryReturnsFalseStillWorkscallsPgSqlSchemaReflectorTest::testUnknownDataTypePassedThroughcallsPgSqlSchemaReflectorTest::testVarcharStringLengthcallsPgSqlSchemaReflectorTest::testVerifyColumnsQueryExactcallsPgSqlSchemaReflectorTest::testVerifyPkQueryExactcallsPgSqlSchemaReflectorTest::testVerifyReflectAllListQuerycalls
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Method calls 3
- method-call ZtdQuery\Platform\Postgres\PgSqlSessionFactory::create() packages/ztd-query-postgres/src/PgSqlSessionFactory.php:64
- method-call ZtdQuery\Platform\Postgres\Session\SchemaInitializer::populate() packages/ztd-query-postgres/src/Session/SchemaInitializer.php:26
- method-call ZtdQuery\Platform\Postgres\Session\SchemaInitializer::populate() packages/ztd-query-postgres/src/Session/SchemaInitializer.php:32