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

Support sequence names for primary key ids (will help PostgreSQL) #10

Open
saberworks opened this issue Jun 3, 2011 · 3 comments
Open
Labels

Comments

@saberworks
Copy link
Contributor

Right now when "adding" a new row it attempts to insert a null value for the primary key. This works in MySQL when auto_increment is used. I would like to see support for a new argument (maybe called "sequence") that specifies which sequence to use to generate the primary key before the insert happens. This will help with PostgreSQL support.

In case you're not familiar with sequences the idea is that I can SELECT NEXTVAL('sequencename'); to grab the next available ID for a specific sequence. It's common for non-MySQL dbs to use sequences instead of auto_increment columns (yes I know Postgres has a "serial" option that does the same thing but I am not using it).

I may be able to work on a patch for this in the next week or so, just wanted to document it as a request.

@bigpresh
Copy link
Owner

bigpresh commented Jun 3, 2011

This sounds useful. I don't make big use of PostgreSQL myself, and when I have I've used 'serial' to get similar behaviour to MySQL, so I'm not very familiar with how this should be done.

If you get a chance to work on a patch that would be fantastic; alternatively a bit of guidance on the insert query that should be generated to make proper use of a sequence would be useful.

@bigpresh
Copy link
Owner

bigpresh commented Oct 7, 2011

This one has sat without attention for a long time - sorry about that!

If this would still be useful to you, a little guidance on the best way to do it would be appreciated, as I'm a bit rusty when it comes to PostgreSQL, and when I have used it, I've always used 'serial' to get similar auto-increment behaviour to MySQL.

@saberworks
Copy link
Contributor Author

Thanks for the attention, actually this would still be useful and I will get to it at some point. The project I'm working on that needs it got placed on the back burner for the near term so it may be a few weeks. But thanks again!

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

No branches or pull requests

2 participants