Processing data from table using awk.

From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Processing data from table using awk.
Date: 2015-10-06 14:04:35
Message-ID: CAAJSdjis9+PgWvLGmuLcCQpbWj23D__0hjuaLOLtQ0WjQFQViQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm wanting to do some reporting on data which I have an a PostgreSQL
table. For lack of anything better, I've decided to see if I can do it in
GNU awk. OK, using Perl with DBI might be a better idea, I'll grant you
that. Or maybe Python or Ruby (which I don't know). But out of shear
cussedness, I'm going to see what I can do in gawk. What I don't see is a
way to get the data out of PostgreSQL and into my awk program. Does anybody
know of a way to do this, short of "cheating" by using psql? Yes, I know
that I could do something like (BASH on Linux/Fedora 22 x86_64):

awk -f some-program.awk <(echo 'SELECT a, b, c, d FROM schema.table ORDER
BY a' | psql dbname)

What I was hoping for was a "Dynamic Extension" (dll) which would allow
"native" use of PostgreSQL, or may ODBC. But I haven't found any. Have I
missed anything? If I were to create such a beastie, would it be of any use
to others? I guess, in this, I'm wondering what "report writer" most are
using when psql just doesn't have sufficient capability.

Yeah, sometimes I'm just plain stupid & pig headed. But then it will be a
"leaning experience" (with associated scars, I'm sure).

--

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-10-06 14:14:32 Re: Recording exceptions within function (autonomous transactions?)
Previous Message Steve Pribyl 2015-10-06 13:41:11 Re: BDR Rejoin of failed node, hangs.