Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-08 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 4:31 PM, John R Pierce wrote: > On 9/7/2016 1:36 PM, Ken Tanzer wrote: > >> No transformation is needed, except for padding the fields out to their >> maximum lengths. >> > > without accessing metadata, how would you know what those maximum lengths > are?? > I agree you'd

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-08 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 4:39 PM, Adrian Klaver wrote: > On 09/07/2016 04:25 PM, Jim Nasby wrote: > >> On 9/7/16 6:07 PM, Ken Tanzer wrote: >> >>> ERROR: PL/Python functions cannot accept type record >>> >> >> Ugh, yeah... that won't work. plperl might be able to do it, but I >> suspect you're goi

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Adrian Klaver
On 09/07/2016 04:25 PM, Jim Nasby wrote: On 9/7/16 6:07 PM, Ken Tanzer wrote: ERROR: PL/Python functions cannot accept type record Ugh, yeah... that won't work. plperl might be able to do it, but I suspect you're going to be stuck pulling the size info out of info_schema or the catalog. Actu

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread John R Pierce
On 9/7/2016 1:36 PM, Ken Tanzer wrote: No transformation is needed, except for padding the fields out to their maximum lengths. without accessing metadata, how would you know what those maximum lengths are?? and how would the calling program even know what the fields are if its not aware of

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Jim Nasby
On 9/7/16 6:07 PM, Ken Tanzer wrote: ERROR: PL/Python functions cannot accept type record Ugh, yeah... that won't work. plperl might be able to do it, but I suspect you're going to be stuck pulling the size info out of info_schema or the catalog. Actually, there is a way you could hack thi

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Adrian Klaver
On 09/07/2016 03:38 PM, Jim Nasby wrote: On 9/7/16 5:32 PM, Ken Tanzer wrote: SELECT my_cat(ebh_gain,'ebh_gain') FROM ebh_gain; I know TCL and probably Python and others can work with a record as a trigger function. But TCL doesn't seem to accept a record as an argument. Can any of the other

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 3:38 PM, Jim Nasby wrote: > On 9/7/16 5:32 PM, Ken Tanzer wrote: > >> SELECT my_cat(ebh_gain,'ebh_gain') FROM ebh_gain; >> >> I know TCL and probably Python and others can work with a record as a >> trigger function. But TCL doesn't seem to accept a record as an >> argumen

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 3:46 PM, Adrian Klaver wrote: > On 09/07/2016 03:32 PM, Ken Tanzer wrote: > >> >> >> On Wed, Sep 7, 2016 at 3:18 PM, Adrian Klaver > > wrote: >> >> On 09/07/2016 01:36 PM, Ken Tanzer wrote: >> >> >> >> On Wed, Sep 7, 2016 at 1:2

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Adrian Klaver
On 09/07/2016 03:32 PM, Ken Tanzer wrote: On Wed, Sep 7, 2016 at 3:18 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: On 09/07/2016 01:36 PM, Ken Tanzer wrote: On Wed, Sep 7, 2016 at 1:22 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Tom Lane
Jim Nasby writes: > On 9/7/16 5:32 PM, Ken Tanzer wrote: >> I know TCL and probably Python and others can work with a record as a >> trigger function. But TCL doesn't seem to accept a record as an >> argument. Can any of the other languages that could also accomplish >> this function? Or some ot

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Jim Nasby
On 9/7/16 5:32 PM, Ken Tanzer wrote: SELECT my_cat(ebh_gain,'ebh_gain') FROM ebh_gain; I know TCL and probably Python and others can work with a record as a trigger function. But TCL doesn't seem to accept a record as an argument. Can any of the other languages that could also accomplish this

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 3:18 PM, Adrian Klaver wrote: > On 09/07/2016 01:36 PM, Ken Tanzer wrote: > >> >> >> On Wed, Sep 7, 2016 at 1:22 PM, Adrian Klaver > > wrote: >> >> On 09/07/2016 01:15 PM, Ken Tanzer wrote: >> >> Hi. Using version 9.2. I'm try

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Adrian Klaver
On 09/07/2016 01:36 PM, Ken Tanzer wrote: On Wed, Sep 7, 2016 at 1:22 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: On 09/07/2016 01:15 PM, Ken Tanzer wrote: Hi. Using version 9.2. I'm trying to create a function that will take a record from any vie

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Ken Tanzer
On Wed, Sep 7, 2016 at 1:22 PM, Adrian Klaver wrote: > On 09/07/2016 01:15 PM, Ken Tanzer wrote: > >> Hi. Using version 9.2. I'm trying to create a function that will take >> a record from any view and assemble it into a string, for export to >> another system. For example, this view: >> >> \d

Re: [GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Adrian Klaver
On 09/07/2016 01:15 PM, Ken Tanzer wrote: Hi. Using version 9.2. I'm trying to create a function that will take a record from any view and assemble it into a string, for export to another system. For example, this view: \d ebh_gain View "public.ebh_gain" Column |

[GENERAL] How to assemble all fields of (any) view into a string?

2016-09-07 Thread Ken Tanzer
Hi. Using version 9.2. I'm trying to create a function that will take a record from any view and assemble it into a string, for export to another system. For example, this view: > \d ebh_gain View "public.ebh_gain" Column | Type | Modifiers ---+-