SELECT UNNEST(ARRAY[1,2,3,4])
在执行上述询问时,我发现这样的错误:
ERROR: function unnest(integer[]) does not exist in postgresql.
我正在使用PogreSQL 8.3,我已在我的血布安装了<代码>_int.sql的套件,用于喷洒阵列操作。
如何解决这一错误?
SELECT UNNEST(ARRAY[1,2,3,4])
在执行上述询问时,我发现这样的错误:
ERROR: function unnest(integer[]) does not exist in postgresql.
我正在使用PogreSQL 8.3,我已在我的血布安装了<代码>_int.sql的套件,用于喷洒阵列操作。
如何解决这一错误?
<代码>unnest( is not part of the modelintarray
, but of standard PostgreSQL. 但是,need Postgres 8.4或此后。
因此,你可以通过升级到更近的版本来解决这一问题。 见,《邮政总局项目的转化政策。
此处为8.4级以下人员:
CREATE OR REPLACE FUNCTION unnest(anyarray)
RETURNS SETOF anyelement
LANGUAGE sql IMMUTABLE AS
SELECT $1[i] FROM generate_series(array_lower($1,1), array_upper($1,1)) i ;
只有<>单程阵列>的工程,而不是现代的<代码>unnest(,这些工程也涉及多个方面:
SELECT unnest( {1,2,3,4} ::int[]) -- works
SELECT unnest( {{1,2},{3,4},{5,6}} ::int[]) -- fails (returns all NULLs)
请
CREATE OR REPLACE FUNCTION unnest2(anyarray) -- for 2-dimensional arrays
RETURNS SETOF anyelement
LANGUAGE sql IMMUTABLE AS
$func$
SELECT $1[i][j]
FROM (
SELECT i, generate_series(array_lower($1,2), array_upper($1,2)) AS j
FROM generate_series(array_lower($1,1), array_upper($1,1)) i
) sub;
$func$;
呼吁:
SELECT unnest2( {{1,2},{3,4},{5,6}} ::int[]) -- works
你还可以写出涉及多个方面的内容的笔记/笔记/笔记。
我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。
On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...
I ll take the simplest of the SQL functions as an example: CREATE OR REPLACE FUNCTION skater_name_match(INTEGER,VARCHAR) RETURNS BOOL AS $$ SELECT $1 IN (SELECT skaters_skater.competitor_ptr_id ...
I m 在当地网络上运行几台机器,在Salgresql8.3处撰写一份申请。
I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.
Hey, I have 2 tables in PostgreSql: 1 - documents: id, title 2 - updates: id, document_id, date and some data: documents: | 1 | Test Title | updates: | 1 | 1 | 2006-01-01 | | 2 | 1 | 2007-01-01 |...
I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...
I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...