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

Closed
doctrinebot opened this issue Apr 29, 2014 · 5 comments
Closed

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

doctrinebot opened this issue Apr 29, 2014 · 5 comments
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user intuxicated:

Hi
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.

@doctrinebot
Copy link
Author

Comment created by @deeky666:

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

@chrisguitarguy
Copy link
Contributor

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;
}

@lcobucci
Copy link
Member

Awesome, thanks @chrisguitarguy!

@lcobucci
Copy link
Member

Closing as per @chrisguitarguy's review

@lcobucci lcobucci assigned lcobucci and unassigned beberlei Nov 12, 2017
@github-actions
Copy link

github-actions bot commented Aug 3, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants