Project

General

Profile

« Previous | Next » 

Revision 10984

schemas/util.sql: added offset2row_num() and use it in mk_subset_by_row_num_func() for clarity

View differences:

schemas/util.sql
1352 1352
  RETURNS SETOF $$||view_||$$ AS
1353 1353
$BODY1$
1354 1354
SELECT * FROM $$||util.type_qual_name(view_::text::regtype)||$$
1355
WHERE $$||quote_ident(row_num_col)||$$ BETWEEN COALESCE($2, 0)+1 AND COALESCE(COALESCE($2, 0)+1 + $1 - 1, 2147483647)
1355
WHERE $$||quote_ident(row_num_col)||$$ BETWEEN util.offset2row_num($2) AND COALESCE(util.offset2row_num($2) + $1 - 1, 2147483647)
1356 1356
$BODY1$
1357 1357
  LANGUAGE sql STABLE
1358 1358
  COST 100
......
1434 1434

  
1435 1435

  
1436 1436
--
1437
-- Name: offset2row_num(integer); Type: FUNCTION; Schema: util; Owner: -
1438
--
1439

  
1440
CREATE FUNCTION offset2row_num(offset_ integer) RETURNS integer
1441
    LANGUAGE sql IMMUTABLE
1442
    AS $_$
1443
SELECT COALESCE($1, 0)+1
1444
$_$;
1445

  
1446

  
1447
--
1437 1448
-- Name: raise_undefined_column(col_ref); Type: FUNCTION; Schema: util; Owner: -
1438 1449
--
1439 1450

  

Also available in: Unified diff