pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rui DeSousa <rui@crazybean.net>
To: Campbell, Lance <lance@illinois.edu>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: How to insert from linux to postgreSQL
Date: Mon, 8 Apr 2019 15:33:42 -0400
Message-ID: <80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net> (raw)
In-Reply-To: <4FB9BF8B-D26C-40FB-9A9C-DEB4FB016292@illinois.edu>
References: <4FB9BF8B-D26C-40FB-9A9C-DEB4FB016292@illinois.edu>

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@illinois.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

view thread (6+ messages)  latest in thread

Message-ID: <80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net>
Permalink:  ../80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net/
Also on:    postgresql.org/message-id/80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: rui@crazybean.net, lance@illinois.edu
  Subject: Re: How to insert from linux to postgreSQL
  In-Reply-To: <80D01A64-24BA-420D-B963-2F8BCDA8AA7D@crazybean.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox