=?ISO-8859-1?Q?Bj=F6rn_Lundin?= <b.f.lundin@xxxxxxxxx> writes: > I'm connecting via libpq and want to > use prepared statements in a cursor. You can't. If you're just interested in fetching a large query result in sections, there is protocol-level support for doing that without an explicit cursor, but libpq doesn't expose that feature because it doesn't fit into its API very well. (I think JDBC does expose it, but that doesn't help you if you want to code in C...) A well-thought-out API proposal would probably be favorably received. If you wanted some other cursor feature like scrollability, the whole thing is a bit problematic, because the prepared statement's plan was not made with the intention of using it that way (yes, DECLARE CURSOR is planned differently than a plain select). regards, tom lane