The problem is as follows:
There is a legacy intranet app that is, basically, a bunch of web forms.
The DB that serves it is Postgres.
The app is documented (poorly, but documented) so I am more or less aware which rows and columns are involved in what.
What I want, is to be able to count all the human-readable characters (spacebars included) that were entered in the web form’s text fields (basically, do the equivalent of Openoffice Writer’s / MS Word’s Statistics feature, but only with character count. Counting words not needed)
The values of text fields are strewn across several tables.
Use scenario:
There is a bunch of text that has to be fed to that DB via web form, it is now handwritten.
A person will come and type it in.
Person is going to be paid per-character.
So the idea is to do a “character count” from the DB at beginning of day, and then do a “character count” after workday. Subtract the former from the latter and pay the typist his due.
There will be no more than one typist working at a given time, so determining who is responsible for given new characters is not required.
Basically, you need query like this:
where C1, …, CN and T1, …, TN are column and table names respectively.
if table X has multiple text columns you can merge multiple
(select sum(length(CX)) from TX)queries into one: