Skip to content

ID integer values too large for column type 'integer' in postgres #3

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

Closed
ccwittwer opened this issue May 7, 2014 · 3 comments · Fixed by #9
Closed

ID integer values too large for column type 'integer' in postgres #3

ccwittwer opened this issue May 7, 2014 · 3 comments · Fixed by #9

Comments

@ccwittwer
Copy link

generateKey function in Repository outputs a 10-digit integer, which is used for a record ID. The integer can exceed max size for Postgres integer column.

    protected function generateKey($value)
    {
        $hash = sha1($value);
        $integerHash = base_convert($hash, 16, 10);

        return (int)substr($integerHash, 0, 10);
    }

Changing the substring length will correct the issue.

    protected function generateKey($value)
    {
        $hash = sha1($value);
        $integerHash = base_convert($hash, 16, 10);

        return (int)substr($integerHash, 0, 8);
    }
@frankpinto
Copy link

Was this ever addressed? Considering using this for Laravel 4 but I think I won't if 6 months have gone by without any word on such a simple issue

@clphillips
Copy link
Contributor

generateKey() always returns the max 32-bit signed integer when using 32-bit PHP.

@whatyoubendoing
Copy link

This is fixed in #12. With the ability to add custom key generators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants