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

rowMode = 'array' apparently provides no way of getting column names #3167

Open
neilmiddleton opened this issue Mar 11, 2024 · 3 comments
Open
Labels

Comments

@neilmiddleton
Copy link

We were experimenting with node-postgres and found that columns were lost in the result set if they had the same name, because of how JSON works.

However, after switching to array we don't apparently have any way of knowing the column names. Is there a way of doing this or is this a shortfall?

(for context, in this scenario, we don't know the query we're running)

@charmander
Copy link
Collaborator

It looks like result.fields should continue to work (an array of field descriptions with name properties).

@neilmiddleton
Copy link
Author

Sorry, should have mentioned, I'm using cursor here. Given cursor.read(n) returns rows it's not clear how to also get column names.

@brianc
Copy link
Owner

brianc commented Mar 12, 2024

Sorry, should have mentioned, I'm using cursor here. Given cursor.read(n) returns rows it's not clear how to also get column names.

Oofff yeh that might have been an oversight on my part. I'll leave this open so I can get to remedying this in some way in the near future.

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

3 participants