pggeodb.nancy.inra.fr/db_cefs - db_cefs on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: _raster_constraint_info_scale

 

 

Schema

public

 

Owner

postgres

 

Descriptions

There is no description for function _raster_constraint_info_scale

 

Options

Option

Value

Returns

double precision

Language

sql

Parameters

rastschema name

rasttable name

rastcolumn name

axis char

 

Definition

CREATE OR REPLACE FUNCTION public._raster_constraint_info_scale (
 rastschema name,
 rasttable name,
 rastcolumn name,
 axis char
)
RETURNS double precision AS
$span$
WITH
c AS (SELECT
regexp_replace(
replace(
split_part(
split_part(s.consrc, ' = ', 2),
'::', 1
),
'round(', ''
),
'[ ''''\(\)]', '', 'g'
)::text AS val
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
WHERE n.nspname = $1
AND c.relname = $2
AND a.attname = $3
AND a.attrelid = c.oid
AND s.connamespace = n.oid
AND s.conrelid = c.oid
AND a.attnum = ANY (s.conkey)
AND s.consrc LIKE '%st_scale' || $4 || '(% = %')
-- if it is a comma separated list of two numbers then need to use round
  SELECT CASE WHEN split_part(c.val,',', 2) > ''
       THEN round( split_part(c.val, ',',1)::numeric, split_part(c.val,',',2)::integer )::float8
       ELSE c.val::float8 END
       FROM
c;
$span$
LANGUAGE
'sql'
STABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23
Previous topic Chapter index Next topic