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

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: How to assemble all fields of (any) view into a string?
Дата
Msg-id f3e9a81c-f194-35a2-ea05-fd471b13faf3@aklaver.com
обсуждение исходный текст
Ответ на How to assemble all fields of (any) view into a string?  (Ken Tanzer <ken.tanzer@gmail.com>)
Ответы Re: How to assemble all fields of (any) view into a string?  (Ken Tanzer <ken.tanzer@gmail.com>)
Список pgsql-general
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       |     Type      | Modifiers
> -------------------+---------------+-----------
>  reporting_unit_id | character(3)  |
>  case_id           | character(10) |
>  event_date        | character(8)  |
>  ids_score         | character(1)  |
>  eds_score         | character(1)  |
>  sds_score         | character(1)  |
>  kc_auth_number    | integer       |
>  king_county_id    | integer       |
>
> would get converted into a string with all the fields concatenated
> together, and space-padded to their full lengths.

I think an example is needed. I was thinking you wanted the field values
transformed, but the below seems to indicate something different.

>
> My original idea was to do this in TCL by passing a record and a view
> name.  The function would then look up the columns in the
> information_schema, and use that info to assemble and return the
> string.  But it looks like TCL functions won't accept a record as an
> argument.
>
> Any suggestions or advice most welcome.  Thanks!
>
> Ken
> --
> AGENCY Software
> A Free Software data system
> By and for non-profits
> /http://agency-software.org//
> /https://agency-software.org/demo/client/
> ken.tanzer@agency-software.org <mailto:ken.tanzer@agency-software.org>
> (253) 245-3801
>
> Subscribe to the mailing list
> <mailto:agency-general-request@lists.sourceforge.net?body=subscribe> to
> learn more about AGENCY or
> follow the discussion.


--
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Ken Tanzer
Дата:
Сообщение: How to assemble all fields of (any) view into a string?
Следующее
От: Ken Tanzer
Дата:
Сообщение: Re: How to assemble all fields of (any) view into a string?