Postgresql indices (was Re: lisp mail archive software)
Daniel Barlow <[email protected]> Mon, 07 Jul 2003 14:53:10 +0100
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John DeSoi <[email protected]> writes: > I suspected this was the case. I'm doing something similar and opted > for a serial primary key for instances. It would be nice get an object > ID back from the insert without the need to call currval, but I > thought this was the best way to go since indexing is taken care of > with the primary key specification. Isn't that potentially racey? What happens if another user does an insert between when you do yours and when you call currval? (Of coruse, if you're not multithreaded and you're the only user, this is not a problem in practice) I'm actually using a serial primary key anyway, because I was burnt by postgres in days of yore, so the idea of depending on oids to stay constant across a database dump/restore gives me the willies. (Yes, I know there's an option for it. That it isn't the _default_ suggests that it's not a normal thing to do, however). In fact I'd prefer it if postgres would give me the primary key value back instead of the oid, because that's what I really wanted. Hmm. Perhaps I should wrap the insert in a function that does this atomically, if such a thing is possible. - -dan - -- http://www.cliki.net/ - Link farm for free CL-on-Unix resources -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/CXtPHDK5ZnWQiRMRAtzpAJwLDxGgR7a6TiAzOJ982suI1Sn9GwCgtG+s RT7vMM4+U4t43neQBcJMYOs= =dTXU -----END PGP SIGNATURE-----