User Documentation
 All Files Functions Groups
utilities.sql_in File Reference

SQL functions for carrying out routine tasks. More...

Go to the source code of this file.

Functions

text version ()
 Return MADlib build information. More...
 
void assert (boolean condition, varchar msg)
 Raise an exception if the given condition is not satisfied.
 
float8 relative_error (float8 approx, float8 value)
 Compute the relative error of an approximate value.
 
float8 relative_error (float8[] approx, float8[] value)
 Compute the relative error (w.r.t. the 2-norm) of an apprixmate vector.
 
boolean check_if_raises_error (text sql)
 Check if a SQL statement raises an error. More...
 
boolean check_if_col_exists (text source_table, text column_name)
 Check if a column exists in a table. More...
 
boolean isnan (float8 number)
 Check if a floating-point number is NaN (not a number) More...
 
void create_schema_pg_temp ()
 Create the temporary schema if it does not exist yet.
 
void noop ()
 Create volatile noop function. More...
 
CREATE OR REPLACE FUNCTION MADlib __internal_get_col_names_except_dep_variable (source_table VARCHAR--name of input table, dependent_varname VARCHAR--name of dependent variable) RETURNS VARCHAR AS $$DECLARE col_names VARCHAR[]
 Get all column names except dependent variable.
 

Detailed Description

See Also
For a brief overview of utility functions, see the module description DB Administrator Utilities.

Definition in file utilities.sql_in.

Function Documentation

boolean check_if_col_exists ( text  source_table,
text  column_name 
)
Parameters
source_tableSource table
column_nameColumn name in the table
Returns
TRUE if it exsists and FALSE if not

Definition at line 155 of file utilities.sql_in.

boolean check_if_raises_error ( text  sql)
Parameters
sqlThe SQL statement
Returns
TRUE if an exception is raised while executing sql, FALSE otherwise.

Definition at line 132 of file utilities.sql_in.

boolean isnan ( float8  number)

This function exists for portability. Some DBMSs like PostgreSQL treat floating-point numbers as fully ordered – contrary to IEEE 754. (See, e.g., the PostgreSQL documentation. For portability, MADlib code should not make use of such "features" directly, but only use isnan() instead.

Parameters
number
Returns
TRUE if number is NaN, FALSE otherwise

Definition at line 198 of file utilities.sql_in.

void noop ( )

The only use of this function is as an optimization fence when used in the SELECT list of a query. See, e.g., http://archives.postgresql.org/pgsql-sql/2012-07/msg00030.php

Definition at line 237 of file utilities.sql_in.

text version ( )
Returns
Summary of MADlib build information, consisting of MADlib version, git revision, cmake configuration time, build type, build system, C compiler, and C++ compiler

Definition at line 64 of file utilities.sql_in.