| From: | Rui DeSousa <rui(at)crazybean(dot)net> |
|---|---|
| To: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
| Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
| Subject: | Re: How to insert from linux to postgreSQL |
| Date: | 2019-04-08 19:33:42 |
| Message-ID: | 80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
I would use psql \copy command within a shell script or just not use it.
Personally, I would choose Perl or GoLang if it requires parsing the data before inserting.
Perl: https://www.perl.com/pub/1999/10/DBI.html/ <https://www.perl.com/pub/1999/10/DBI.html/>
Go: https://golang.org/pkg/database/sql/#DB.Prepare <https://golang.org/pkg/database/sql/#DB.Prepare>
> On Apr 8, 2019, at 3:03 PM, Campbell, Lance <lance(at)illinois(dot)edu> wrote:
>
> PostgreSQL 10.x
>
> Use case:
> I want to read a log file on my linux server and write each line out to a row in a postgreSQL table. When I do inserts however I want to make sure I am using prepared statements to avoid SQL injections. I know how to do this is Java but I have not found an example using a linux bash scripts.
>
> Does anyone have an example they could point me to?
>
> Thanks,
>
> Lance
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Silvio Brandani - SDB Information Technology Srl | 2019-04-09 14:11:30 | ERROR: subtransaction logged without previous top-level txn record |
| Previous Message | Scott Whitney | 2019-04-08 19:20:03 | Re: How to insert from linux to postgreSQL |