Divide table raw into chunks - Mailing list pgsql-novice

From Shmagi Kavtaradze
Subject Divide table raw into chunks
Date
Msg-id CAHY6maz7csz8sjOpMypAWM6K3cZTEUBSye00UmsfGqbjt-Riqw@mail.gmail.com
Whole thread Raw
Responses Re: Divide table raw into chunks  ("Miguel Beltran R." <yourpadre@gmail.com>)
List pgsql-novice
I have a table with too long entries with 1s and 0s. For example I have table :

| Sent id.|   BoW.   |
|---------|----------|
|    1    | 10100101 |
|    2    | 00011110 |
|    3    | 10101111 |
I want to create new table which will divide column BoW. entries into some arbitrary length and assigns chunk number. 

| Sent id.| Chunk No. | BoW. |
|---------|-----------|------|
|    1    |     1     | 1010 |
|    1    |     2     | 0101 |
|    2    |     1     | 0001 |
|    2    |     2     | 1110 |
|    3    |     1     | 1010 |
|    3    |     2     | 1111 |
I am beginner, tried to search in documentation, but without success. Maybe something like this, but with proper function:

select b.sent_id, chunk, substring(bow from (chunk - 1) * 4 + 1 for 4)
from (select b.sent_id, generate_series(1, 1 + floor(length(bow) - 1 / 4) ) as chunk     from bow1 b    ) b;

I have 4623 Sent ids (sentences) and each is 10,000 characters long. I want to divide them into 32-40 character long chunks. 

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Query to return normalized floats
Next
From: JORGE MALDONADO
Date:
Subject: No password supplied error when running a batch script as a programmed task