Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I store HTML code in a Postgresql DB table field?

I get a large and vary dynamic XML data feed (200+ categories and 3500+ products that is 11+ MB) to CRUD my DB. The problem is, there is HTML code embedded in the long description field (.e.g. links to a video and player settings as well as page layout. YES, I know, a programming no no - should be done with CSS - but it is there anyhow. When creating the database table HTML is not an option. I am using PHP and PostgreSQL on a WAPP stack. How can I get around this problem?

like image 516
MarqKDsade Avatar asked Jan 31 '16 14:01

MarqKDsade


People also ask

Can you store HTML in db?

Certainly it is possible to store html (or whatever markup or language) inside a database.

Can you store files in PostgreSQL database?

The Large Objects feature is a way of storing large files in a PostgreSQL database. Files can normally be stored in bytea columns but there are two downsides; a file can only be 1 GB and the backend buffers the whole file when reading or writing a column, which may use significant amounts of RAM on the backend.

Does PostgreSQL use threads?

PostgreSQL is one of the finest object-relational databases, and its architecture is process-based instead of thread-based. While almost all the current database systems utilize threads for parallelism, PostgreSQL's process-based architecture was implemented prior to POSIX threads.


1 Answers

You could try using a TEXT field and dump the HTML there.

Additionally, PostgreSQL has in-built automatic compression for TEXT fields!

like image 114
Robins Tharakan Avatar answered Oct 18 '22 00:10

Robins Tharakan