Skip to content

pgp.helpers.insert ordering #843

Answered by bdharrington7
DJDaveMark asked this question in Q&A
Discussion options

You must be logged in to vote

You cannot depend on queries to return ordered results unless you specify an ORDER BY clause.

a query where the insert values will always appear in the same order as they appear in the data array

If you need query order to be the same as insertion order, if you set up a serial data type column (usually done as a primary key), then you can sort on that column to get results back in the same way they were inserted.

You could also use your approach of supplying the index of the element in the data array as part of the row.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DJDaveMark
Comment options

Answer selected by DJDaveMark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants