2010/3/29 Andrus :
>> If renaming the function makes it appear to work differently,
>> then there is another function of similar name in there somewhere.
>> I'm betting the server is not 8.1 after all.
>
> I'm using
>
> "PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit"
>
oh sorry, you
If renaming the function makes it appear to work differently,
then there is another function of similar name in there somewhere.
I'm betting the server is not 8.1 after all.
I'm using
"PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit"
Andrus.
--
Sent via pgsql-general mailing list
Pavel Stehule writes:
> 2010/3/29 Tom Lane :
>> I think if it appeared to work before it was because the built-in
>> unnest() function was capturing the call.
> he uses 8.1. the bug is in "generate_series(1,>>>4<<<)"
If renaming the function makes it appear to work differently,
then there is ano
sql;
>
> select unnest21(string_to_array('23,2,3,4,5',','));
>
> Andrus.
>
> - Original Message - From: "Tom Lane"
> To: "Andrus"
> Cc: "Pavel Stehule" ;
>
> Sent: Monday, March 29, 2010 6:00 PM
> Subject:
"Andrus" writes:
> I changed unction name and tried:
> CREATE OR REPLACE FUNCTION unnest21(anyarray)
> RETURNS SETOF anyelement as $$
> SELECT $1[i] FROM generate_series(1,4) g(i)
> $$ LANGUAGE sql;
> select unnest21(string_to_array('23,2,3,4,5',','));
> In this case it returns only 4 rows.
>
2010/3/29 Tom Lane :
> "Andrus" writes:
>> I changed unction name and tried:
>> CREATE OR REPLACE FUNCTION unnest21(anyarray)
>> RETURNS SETOF anyelement as $$
>> SELECT $1[i] FROM generate_series(1,4) g(i)
>> $$ LANGUAGE sql;
>
>> select unnest21(string_to_array('23,2,3,4,5',','));
>
>> In this
2010/3/29 Andrus :
> Pavel
>
> thank you.
> How to add word wrap to this at some column between words ?
> For example string
> ' '
>
> if word wrap is at column 12 should produce table with two rows:
>
>
>
>
You can't do it. This working only for one column.
" ;
Sent: Monday, March 29, 2010 6:00 PM
Subject: Re: [GENERAL] Splitting text column to multiple rows
"Andrus" writes:
Pavel,
pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
unnest
23
2
3
4
(4 rows)
Result is wron
ea what is happening.
Andrus.
- Original Message -
From: "Tom Lane"
To: "Andrus"
Cc: "Pavel Stehule" ;
Sent: Monday, March 29, 2010 6:00 PM
Subject: Re: [GENERAL] Splitting text column to multiple rows
"Andrus" writes:
Pavel,
pa...@postgres:548
Pavel
thank you.
How to add word wrap to this at some column between words ?
For example string
' '
if word wrap is at column 12 should produce table with two rows:
Andrus.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make
"Andrus" writes:
> Pavel,
>> pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
>> unnest
>>
>> 23
>> 2
>> 3
>> 4
>> (4 rows)
> Result is wrong: it must contain 5 rows.
Surely that's a copy-and-paste mistake? I get 5 rows from this example.
2010/3/29 Andrus :
> Pavel,
>
>> CREATE OR REPLACE FUNCTION unnest(anyarray)
>> RETURNS SETOF anyelement as $$
>> SELECT $1[i] FROM generate_series(1,4) g(i)
>> $$ LANGUAGE sql;
>>
>> pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
>> unnest
>>
>> 23
>> 2
>> 3
>> 4
Pavel,
CREATE OR REPLACE FUNCTION unnest(anyarray)
RETURNS SETOF anyelement as $$
SELECT $1[i] FROM generate_series(1,4) g(i)
$$ LANGUAGE sql;
pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
unnest
23
2
3
4
(4 rows)
Result is wrong: it must contain 5 rows.
Ho
2010/3/29 Andrus :
>> no it is in same order. generate_series generates indexes from
>
> 1,2,3 so result have to be exactly in same order. You do some
> wrong.
>
> In my sample I used joind and projecton this changes order.
> How to add order number 1,2,.. to created table ?
>
you cannot use j
no it is in same order. generate_series generates indexes from
1,2,3 so result have to be exactly in same order. You do some
wrong.
In my sample I used joind and projecton this changes order.
How to add order number 1,2,.. to created table ?
Andrus.
--
Sent via pgsql-general mailing list (
2010/3/28 Andrus :
>> CREATE OR REPLACE FUNCTION unnest(anyarray)
>> RETURNS SETOF anyelement as $$
>> SELECT $1[i] FROM generate_series(1,4) g(i)
>> $$ LANGUAGE sql;
>>
>> pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
>
> I tried code below. Order of rows in result is di
CREATE OR REPLACE FUNCTION unnest(anyarray)
RETURNS SETOF anyelement as $$
SELECT $1[i] FROM generate_series(1,4) g(i)
$$ LANGUAGE sql;
pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
I tried code below. Order of rows in result is different from the order of
elements i
Hello
try:
CREATE OR REPLACE FUNCTION unnest(anyarray)
RETURNS SETOF anyelement as $$
SELECT $1[i] FROM generate_series(1,4) g(i)
$$ LANGUAGE sql;
pa...@postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
unnest
23
2
3
4
(4 rows)
regards
Pavel Stehule
2010/3/28
TEXT column contains multi-line text.
How to split it to multiple rows so that every line is in separate row ?
Code below should return two rows,
Line 1
Line 2
Solution should work starting at 8.1
Should generate_series or pgsql procedure used or any other idea?
Andrus.
create temp table tes
19 matches
Mail list logo