[DBAL-525] PostgreSQL - getDateTimeFormatString() missing Created: 22/May/13 Updated: 22/May/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Jan Pecek | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | datetime, format, postgresql | ||
| Environment: |
PostgreSQL Database |
||
| Description |
|
Using PostgreSQL and column with "timestamp without time zone" returns datetime in format Y-m-d H:i:s.u but not always. If u is zero the PHP driver returns Y-m-d H:i:s format only. Specification of function getDateTimeFormatString is missing for this case too. It's required to resolve described different two formats and add getDateTimeFormatString with usec to postgres platform |
[DBAL-477] Just doublequote all schema names and field names in PostgreSQL sql command generation, and the same for MySQL Created: 28/Mar/13 Updated: 28/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms, Schema Managers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | mysql, postgresql | ||
| Environment: |
Any PostgreSQL environment |
||
| Description |
|
Generation of any SQL command to the database (From entities or migration versions) does not quote all the reserved keywords (For example a fieldname `right`. Simple fix that always works: double-quote dbname, schemaname and fieldname e.g "dbsecurity"."userschema"."users" or "tblusers" MySQL : use the ` sign. e.g `security`.`users` or `tblusers` (No support for schemas since I last checked some time ago) |
[DBAL-474] SchemaManager / Connection on PostgreSQL platform does not respect filterExpression for sequences Created: 27/Mar/13 Updated: 24/Apr/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | postgresql, schematool | ||
| Environment: |
Windows & Linux |
||
| Description |
|
Dear Symfony team, the filterExpression on AbstractSchemaManager seems not to work for sequences. This only happens under postgres. It seems the way the sequences are handled are the culprit: It tries to get min_value etc of sequences without matching sequence names to the filter expression in advance. If for example access to the sequences is denied, (Different schema without permissions for the current entity manager), any higher-level ORM operations like generating migration versions fail. --------------------- UPDATE the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$ |
| Comments |
| Comment by Benjamin Eberlei [ 14/Apr/13 ] |
|
Can you paste an exception trace? I see that filtering is applied to sequences, but your description seems to indicate this happens due to an SQL query much earlier? |
| Comment by jos de witte [ 24/Apr/13 ] |
|
Dear Benjamin, the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$ |
[DBAL-420] Schema Drop SQL incorrect on PostgreSQL with entities with GeneratedValue(strategy="IDENTITY") Created: 23/Jan/13 Updated: 14/Apr/13 Resolved: 14/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | 2.3.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Adam Ashley | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | postgresql, schematool | ||
| Environment: |
Symfony 2.1, PHP5.4, PostgreSQL 9.1 on Ubuntu 12.04 |
||
| Description |
|
This problem is probably related to # When schema drop is run the following error occurs: SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop sequence radacct_radacctid_seq because other objects depend on it The source of this problem is the difference between strategy="IDENTITY" and strategy="SEQUENCE" With SEQUENCE doctrine creates the table schema with field type BIGINT and no specified. It then creates a seperate sequence and as far as I can tell takes care of getting and inserting the next id number itself. With IDENTITY doctrine creates the table schema with field type BIGSERIAL and no specified default. Now postgres automatically creates a sequence and creates the column with type BIGINT and sets the DEFAULT to the pgpsql statement required to get the nextval from the sequence. At this point the two differently configured tables will work successfully and identically, except SEQUENCE tables will only get a correct new ID when run through the doctrine code while IDENTITY tables will get the correct new ID whenever an insert is done to the table. Because in the case of an IDENTITY field postgresql creates the field with a default value refering to the sequence the sequence can not be deleted before the table reference is removed. For my case I need the IDENTITY fields to work as we have a RADIUS server that needs to insert into one table which is managed and mapped to an entity in Doctrine. Swapping the order of DROP TABLE and DROP SEQUENCE commands in Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php in getQueries() line 159. Does not work as a quick fix. The following error occurs as the sequence is quite correctly be dropped along with the table. Doctrine\DBAL\DBALException: An exception occurred while executing 'DROP SEQUENCE radacct_radacctid_seq': SQLSTATE[42P01]: Undefined table: 7 ERROR: sequence "radacct_radacctid_seq" does not exist |
| Comments |
| Comment by Adam Ashley [ 24/Jan/13 ] |
|
This issue also appears to affect Doctrine_Migrations. Generated migrations try to drop and recreate automatically generated sequences associated with SERIAL fields making a mess of the database. |
| Comment by Benjamin Eberlei [ 22/Mar/13 ] |
|
A related Github Pull-Request [GH-289] was opened |
| Comment by Adrien Crivelli [ 12/Apr/13 ] |
|
@Adam Ashley, could you test whether https://github.com/doctrine/dbal/pull/289 solve your issue ? |
| Comment by Doctrine Bot [ 14/Apr/13 ] |
|
A related Github Pull-Request [GH-289] was closed: |
[DBAL-406] PostgreSqlSchemaManager::tablesExist() misses schema-qualified table names if they exist in the first schema on the search path Created: 07/Jan/13 Updated: 07/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Roger Hunwicks | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | postgresql | ||
| Environment: |
Postgresql 9.1 |
||
| Description |
|
Please see https://github.com/doctrine/migrations/issues/99 for additional background. To reproduce: CREATE SCHEMA test_schema; CREATE TABLE test_schema.test_table (test_column TEXT); Then in Doctrine: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$connection->executeUpdate('SET search_path=test_schema;');
$result = $connection->getSchemaManager()->tablesExist(array('test_schema.test_table'));
$result is false when it should be true. The error occurs because PostgreSqlSchemaManager returns the bare table name from getPortableTablesList() if the schema is the first one in the search path. The full explanation is... AbstractSchemaManager::tablesExist() calls $this->getPortableTablesList() before checking if the tables exist. PostgreSqlSchemaManager overrides this in _getPortableTableDefinition() by comparing the schema for the table with the search path for the connection. If the table schema is the first one in the search path, then it returns the bare table name, if it isn't then it returns the schema-qualified table name (i.e. schema.table). tablesExist() does an array_intersect to check that all the tables in the search array exist in the database. If one of the tables in the search array was schema-qualified but also in the first schema on the search path, then you end up checking: array_intersect(array('test_schema.test_table'), array('test_table')) which fails. One way to fix it would be to override tablesExist() in PostgreSqlSchemaManager so that it passes the search array through getPortableTableDefinition() before doing the array_intersect: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
/**
* Return true if all the given tables exist.
*
* @param array $tableNames
* @return bool
*/
public function tablesExist($tableNames)
{
foreach ($tableNames as $key => $tableName) {
if (strpos($tableName, '.') !== false) {
$tableName = explode('.', $tableName, 2);
$tableNames[$key] = $this->_getPortableTableDefinition(array('schema_name'=>$tableName[0], 'table_name'=>$tableName[1]));
}
}
return parent::tablesExist($tableNames);
}
I'm happy to provide a PR on GitHub if you want. |
[DBAL-397] PostgreSQL - getDateTimeTzFormatString() Created: 12/Dec/12 Updated: 17/Dec/12 Resolved: 16/Dec/12 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Phill Pafford | Assignee: | Benjamin Eberlei |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | datetime, dql, format, postgresql | ||
| Environment: |
PostgreSQL Database |
||
| Description |
|
In:
The function: getDateTimeTzFormatString() only returns one datetime format:
/**
* {@inheritDoc}
*/
public function getDateTimeTzFormatString()
{
//return 'Y-m-d H:i:sO'; // original format
return 'Y-m-d H:i:s.uO'; // format also needed
}
Here is the error I get using the original format: Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O If I use this format: 'Y-m-d H:i:s.uO' it works. |
| Comments |
| Comment by Phill Pafford [ 12/Dec/12 ] |
|
adding html tags for code to display correctly |
| Comment by Benjamin Eberlei [ 16/Dec/12 ] |
|
DateTimeTz is created as 'TIMESTAMP(0) WITH TIME ZONE' on DBAL. If you have 'TIMESTAMP(6) WITH TIME ZONE' instead, then you have to create your own datatye. |
| Comment by Phill Pafford [ 17/Dec/12 ] |
|
Why would this be a new data type? I understand how to fix the problem with creating my own data type to handle the formatting issue and would even suggest just overriding the data type with
Type::overrideType('datetimetz', 'Doctrine\DBAL\Types\VarDateTimeType');
Type::overrideType('datetime', 'Doctrine\DBAL\Types\VarDateTimeType');
But it's not a new data type, it's a formatting issue. |
[DBAL-368] array and object types should use BLOB, not CLOB, to store serialized data Created: 19/Oct/12 Updated: 23/Jan/13 Resolved: 23/Jan/13 |
|
| Status: | Closed |
| Project: | Doctrine DBAL |
| Component/s: | None |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Karsten Dambekalns | Assignee: | Benjamin Eberlei |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | postgresql | ||
| Description |
|
When using array or object types, PHP's serialize() is used. Since that can return NUL bytes, using a text type will fail at least on PostgreSQL (just search the web for issues of that kind…). So ArrayType and ObjectType should return a BLOB definition instead of a CLOB definition to be binary-safe. |
| Comments |
| Comment by Karsten Dambekalns [ 19/Oct/12 ] |
|
See DBAL-369 for the suggested fix |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Karsten Dambekalns |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Nvm, it was DBAL-369 |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Moved to DBAL-369 |