Project

General

Profile

Actions

Feature #17080

closed

idea to help make autoincrement fields work better with PostgreSQL

Added by Marcel Gsteiger over 17 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2007-03-05
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Autoincrement fields don't work properly on adodb when used for backend record insertion. If the tca.php specifies different field lists depending of a "record type" field, the backend 'loses' the record when the record type field of a newly created record changes. With native MySQL driver, the autoincrement field is filled in properly, and the backend redisplays the correct record after insertion.
adodb supports the "counter" field type (Metatype R), but this is implemented as a separate type (and not as a "feature" of a field); admin_get_fields($tableName) always sets $fieldRow['Extra'] = ''; when adodb is used as a driver.

My suggestion is to properly fill the $fieldRow['Extra']='auto_increment' in a slightly modified admin_get_fields($tableName) method for those adodb databases that support sequences. For instance, using PostgreSQL 8.x (with SERIAL or BIGSERIAL type for autoincrement fields), the result of the MySQL command 'SHOW columns FROM xxxx' can be easily emulated by the following information_schema query as a first step:

select column_name as "Field", data_type as "Type", CASE WHEN nullif(is_nullable,'YES') = 'NO' then 'YES' END as "Null",
CASE WHEN u.ordinal_position IS NOT NULL THEN 'PRI' ELSE NULL END as "Key", column_default as "Default",
case when column_default = 'nextval(''' || table_name || '_' || column_name || '_seq''::regclass)' then 'auto_increment' else NULL END as "Extra"
from information_schema.columns c
left join information_schema.key_column_usage u using(table_catalog, table_schema, table_name, column_name)
where table_catalog = current_database() and table_schema = ANY (current_schemas(true)) AND table_name = '$mytablename' order by c.ordinal_position;
(issue imported from #M5135)

Actions #1

Updated by Alexander Opitz over 11 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)
  • TYPO3 Version set to 4.1

As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?

Actions #2

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF