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

Is there a way to know the names and types of columns a query returns? #16

Open
vonHabsi opened this issue Mar 20, 2021 · 12 comments
Open

Comments

@vonHabsi
Copy link

Is there a way to know the names and types of columns a query returns?

I'm not acquainted with using libpq at such a low level and I wonder if there is an API for it.

@anse1
Copy link
Owner

anse1 commented Mar 22, 2021 via email

@vonHabsi
Copy link
Author

I am not familiar with working with Postgres at the libpq level and I want to know if those details could be accessed so I know what data types to associate with the columns of the result set.

I know of a for finding names and types of a query by creating a query which returns 0 results and using the information_schema to work them out, so I will resort to that.

Do you have a list of the libpq functions implemented?

@anse1
Copy link
Owner

anse1 commented Mar 24, 2021 via email

@gnusupport
Copy link

I am building tabulated-list-mode based database management, and my main problem is that designation of the column names, and number of columns. psql interface provide that, and it is great. But I would not know how to do it in Emacs.

It would be great to be able to receive a list of column names or their comments, as that way I would get also the number and reporting would become way easier.

I have to designed from my program names of columns instead of fetching it from PostgreSQL, like SQL does it. I will send US $20 when and if this function is implemented that we can get list of column names. Those empty column names could be designated as nil, why not.

example

@anse1
Copy link
Owner

anse1 commented Apr 27, 2021 via email

@gnusupport
Copy link

gnusupport commented Apr 27, 2021 via email

@vonHabsi
Copy link
Author

vonHabsi commented May 12, 2021

Offtopic reply:

Do you have a link to some source code which creates this type of display?

I am building tabulated-list-mode based database management, and my main problem is that designation of the column names, and number of columns. psql interface provide that, and it is great. But I would not know how to do it in Emacs.

It would be great to be able to receive a list of column names or their comments, as that way I would get also the number and reporting would become way easier.

I have to designed from my program names of columns instead of fetching it from PostgreSQL, like SQL does it. I will send US $20 when and if this function is implemented that we can get list of column names. Those empty column names could be designated as nil, why not.

example

@gnusupport
Copy link

gnusupport commented May 13, 2021 via email

@gnusupport
Copy link

gnusupport commented May 14, 2021 via email

@vonHabsi
Copy link
Author

I have installed the above packages and I'm looking forward to the functions.

When you say:

If you suceed to install those, I can then provide the functions for
editing with the tabulated-list-mode

does that mean that the above 2 utilities already provide the means to view the output in tabulated-list-mode?

Can we continue this discussion in another forum to avoid this issue thread going off-topic?

@gnusupport
Copy link

gnusupport commented May 20, 2021 via email

@vonHabsi
Copy link
Author

Thanks.

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

No branches or pull requests

3 participants