Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBAL-879: Sequence default value [PGSQL] #2118

doctrinebot opened this issue Apr 29, 2014 · 4 comments


Copy link

@doctrinebot doctrinebot commented Apr 29, 2014

Jira issue originally created by user intuxicated:

I'm using dbal to generate schmea from database via Schema-Manager. The problem is that my primary field 'id' have default value of 'nextval('test1_id_seq'::regclass)' but when I retrive columns using Doctrine\DBAL\Schema\AbstractSchemaManager::listTableDetails() or Doctrine\DBAL\Schema\Table::getColumns() , default value of the column 'id' is null.
In Doctrine\DBAL\Schema\PostgreSqlSchemaManager::_getPortableTableColumnDefinition() method at line 292 default value replaced with null, I don't know why but I guess It's because Driver compatibility.
Also Doctrine\DBAL\Schema\Sequence has no method to retrieve that table.
So I don't have the default value (pointing at sequence) and I can't find out what Sequence is linked to this table either.


This comment has been minimized.

Copy link

@doctrinebot doctrinebot commented Oct 26, 2014

Comment created by @deeky666:

Can you please provide a code example of how you create table + sequence and retrieve it?


This comment has been minimized.

Copy link

@chrisguitarguy chrisguitarguy commented Nov 7, 2017

I think this one can be closed, looks like nextval is handled correctly now:

if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches)) {
$tableColumn['sequence'] = $matches[1];
$tableColumn['default'] = null;
$autoincrement = true;


This comment has been minimized.

Copy link

@lcobucci lcobucci commented Nov 12, 2017

Awesome, thanks @chrisguitarguy!


This comment has been minimized.

Copy link

@lcobucci lcobucci commented Nov 12, 2017

Closing as per @chrisguitarguy's review

@lcobucci lcobucci closed this Nov 12, 2017
@lcobucci lcobucci assigned lcobucci and unassigned beberlei Nov 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.