Revision 10985
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1180 | 1180 |
|
1181 | 1181 |
|
1182 | 1182 |
-- |
1183 |
-- Name: limit2row_num(integer, integer); Type: FUNCTION; Schema: util; Owner: - |
|
1184 |
-- |
|
1185 |
|
|
1186 |
CREATE FUNCTION limit2row_num(limit_ integer, offset_ integer DEFAULT NULL::integer) RETURNS integer |
|
1187 |
LANGUAGE sql IMMUTABLE |
|
1188 |
AS $_$ |
|
1189 |
SELECT COALESCE(util.offset2row_num($2) + $1 - 1, 2147483647) |
|
1190 |
$_$; |
|
1191 |
|
|
1192 |
|
|
1193 |
-- |
|
1183 | 1194 |
-- Name: map_filter_insert(); Type: FUNCTION; Schema: util; Owner: - |
1184 | 1195 |
-- |
1185 | 1196 |
|
... | ... | |
1352 | 1363 |
RETURNS SETOF $$||view_||$$ AS |
1353 | 1364 |
$BODY1$ |
1354 | 1365 |
SELECT * FROM $$||util.type_qual_name(view_::text::regtype)||$$ |
1355 |
WHERE $$||quote_ident(row_num_col)||$$ BETWEEN util.offset2row_num($2) AND COALESCE(util.offset2row_num($2) + $1 - 1, 2147483647)
|
|
1366 |
WHERE $$||quote_ident(row_num_col)||$$ BETWEEN util.offset2row_num($2) AND util.limit2row_num($1, $2)
|
|
1356 | 1367 |
$BODY1$ |
1357 | 1368 |
LANGUAGE sql STABLE |
1358 | 1369 |
COST 100 |
Also available in: Unified diff
schemas/util.sql: added limit2row_num() and use it in mk_subset_by_row_num_func() for clarity