2003-09-12 01:15:27 +08:00
|
|
|
Array iterator functions have been removed as of PostgreSQL 7.4, because
|
|
|
|
equivalent functionality is now available built in to the backend.
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
For example, previously, using contrib/array, you might have used the
|
|
|
|
following construct:
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
create table t(id int4[], txt text[]);
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
-- select tuples with some id element equal to 123
|
|
|
|
select * from t where t.id *= 123;
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
Now you would do this instead:
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
-- select tuples with some id element equal to 123
|
|
|
|
select * from t where 123 = any (t.id);
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
-- or you could also do this
|
|
|
|
select * from t where 123 = some (t.id);
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
Similarly, if using contrib/array, you did the following:
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
-- select tuples with all txt elements matching '^[A-Z]'
|
|
|
|
select * from t where t.txt[1:3] **~ '^[A-Z]';
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
Now do this instead:
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-12 01:15:27 +08:00
|
|
|
-- select tuples with all txt elements matching '^[A-Z]'
|
|
|
|
select * from t where '^[A-Z]' ~ all (t.txt[1:3]);
|
2000-06-19 22:02:16 +08:00
|
|
|
|
2003-09-14 01:33:46 +08:00
|
|
|
See this section in the PostgreSQL documentation for more detail:
|
|
|
|
The SQL Language => Functions and Operators => Row and Array Comparisons
|