0

Is there any way to run a query and the resulted output to become into an html format. The query may be into a store procedure, for convenience. As an example usage, I think something like that:

select * from my_stored_proc(arg1, arg2) -> [html formated] result set

or any other way.

1
  • 1
    According to the documentation using the -H switch with pgsql command line states a return in HTML type. Commented Jun 30, 2017 at 7:39

2 Answers 2

3

I found this accidentally, I was using psql -H <connectionString> and was not sure why I was getting HTML outputs.

I found it later -H was flag for getting all HTML responses from psql.

Sign up to request clarification or add additional context in comments.

Comments

2

I doudbt you gonna use psql output to render the page, so probably -H is not an option. and there is no other "native" html conversion in Postgres afaik. I'd rather use js parser to consume xml or json, returned by Postgres instead... (I believe most API calls return either json or xml, so parsing should be very common)

Also, look for similar questions, eg Generate HTML from PostgreSQL function

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.