Issue Details (XML | Word | Printable)

Key: DBAL-21
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Benjamin Eberlei
Reporter: Raphaël Dehousse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Doctrine DBAL

Pgsql: getListTableColumnsSQL: read domains info (patch provided)

Created: 13/Jun/10 07:19 AM   Updated: 20/Jun/10 09:05 AM
Component/s: None
Affects Version/s: 2.0.0-BETA2
Fix Version/s: 2.0.0-BETA3

File Attachments: 1. Text File pgsql_domains.patch (1 kB)



 Description  « Hide
Hello,

If you use DOMAIN (CREATE DOMAIN) in pgsql, PostgreSqlPlatform generate a "new \Doctrine\DBAL\DBALException("Unknown database type ".$dbType." requested, " . get_class($this) . " may not support it.");" exception because it does not know the type "domain_name" (CREATE DOMAIN domain_name AS VARCHAR(80); )

With this patch, it checks if the given type (either normal type, either domain) is a domain, and if yes, takes the right info (domain_name is type varchar and complete_type character varying(80)). If it's not a domain, it takes the normal type.

(patch -p0 doctrine2/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php < pgsql_domains.patch)

Also, it's not the goal here, but the queries could be optimized using joins in place of auto join + where, but, as said, the speed is not the goal since the queries are there only for entities mapping.

Hope it helps.

Best regards,

Raphaël Dehousse



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Benjamin Eberlei added a comment - 13/Jun/10 07:32 AM
Let me understand this, this patch automatically detects the underlying type of a new DOMAIN Type created in postgresql?

So say i create a MONEY type and have it be a decimal or something, your code would make doctrine automatically detect it being a decimal and create the decimal doctrine type?


Raphaël Dehousse added a comment - 13/Jun/10 09:07 AM
Indeed, it will detect the "natural" type under MONEY and use this type for doctrine.