Introduction

In general following 21 datatypes are supported in Postgres / PostGIS.

Supported Types by StreamPipes

  1. Numeric Types
  2. Character Types
  3. Boolean Type

Numeric Types

Integer

SupportNameStorage SizeRangeStreamPipes Domain
Nosmallint2 bytes-32768 to +32767
Yesinteger4 bytes-2147483648 to +2147483647http://www.w3.org/2001/XMLSchema#integer
Yesbigint8 bytes-9223372036854775808 to +9223372036854775807http://www.w3.org/2001/XMLSchema#long
Nosmallserial2 bytes1 to 32767
Noserial4 bytes1 to 2147483647
?bigserial8 bytes1 to 9223372036854775807

Floating

SupportNameStorage SizeRangeStreamPipes Domain
Yesdecimalvariableup to 131072 digits before; up to 16383 digits after the decimal pointhttp://www.w3.org/2001/XMLSchema#decimal
Yesfloat (n)max 8 bytesvariablehttp://www.w3.org/2001/XMLSchema#float
Nonumeric (p,s)variableup to 131072 digits before; up to 16383 digits after the decimal point
Noreal4 bytes6 decimal digits precision
Yesdouble precision8 bytes15 decimal digits precisionhttp://www.w3.org/2001/XMLSchema#double

Character Types

SupportNameDescriptionStreamPipes Domain
?char(n)fixed-length, blank padded
?varchar(n)variable-length with limit
Yestextvariable unlimited lengthhttp://www.w3.org/2001/XMLSchema#string

Boolean Types

SupportNameDescriptionStreamPipes Domain
Yesbooleanstate of true or falsehttp://www.w3.org/2001/XMLSchema#boolean

Boolean literals

In standard SQL, a Boolean value can be TRUE, FALSE, or NULL. However, PostgreSQL is quite flexible when dealing with TRUE and FALSE values:

RecognizedTrueFalse
Yestruefalse
?‘t’‘t’
?‘true’‘false’
?'yes''no'
?‘y’‘n’
?‘1’‘0’
?'on''off'
?>1::BOOLEAN0::BOOLEAN

Should be supported by StreamPipes

  1. Date/Time Types
  2. Geometric Types (PostGIS)

Date/Time Types

SupportNameStorage SizeDescriptionLow ValueHigh ValueStreamPipes Domain
Yestimestamp [without time zone]8 bytesboth date and time (nTZ)4713 BC294276 ADhttp://www.w3.org/2001/XMLSchema#dateTime
?timestamp with time zone8 bytesboth date and time, wTZ4713 BC294276 AD
?date4 bytesdate (no time of day)4713 BC5874897 ADhttp://www.w3.org/2001/XMLSchema#date
Yestime [without time zone]8 bytestime of day (no date)00:00:0024:00:00http://www.w3.org/2001/XMLSchema#time
?time with time zone12 bytestime of day (no date), wTZ00:00:00+145924:00:00-1459
Nointerval [ fields ]16 bytestime interval-178000000 years178000000 years

Additional Informations to the table:

  • timestamp: short form for timestamp without time zone
  • timestamptz: short form for timestamp with time zone
  • time, timestamp, and interval accept an optional precision value p which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of p is from 0 to 6.

Date input

Possible inputs for date type and recognized as Date input in Streampipes

RecognizedExampleDescription
?1999-01-08ISO 8601; January 8 in any mode (recommended format)
?January 8, 1999unambiguous in any datestyle input mode
?1/8/1999January 8 in MDY mode; August 1 in DMY mode
?1/18/1999January 18 in MDY mode; rejected in other modes
?01/02/03MDY, DMY and YMD
?1999-Jan-08January 8 in any mode
?Jan-08-1999January 8 in any mode
?08-Jan-1999January 8 in any mode
?99-Jan-08January 8 in YMD mode, else error
?08-Jan-99January 8, except error in YMD mode
?Jan-08-99January 8, except error in YMD mode
?19990108ISO 8601; January 8, 1999 in any mode
?990108ISO 8601; January 8, 1999 in any mode
?1999.008year and day of year
?J2451187Julian date
?January 8, 99 BCyear 99 BC

Time inputs

RecognizedExampleDescription
?04:05:06.789ISO 8601
?04:05:06ISO 8601
?04:05ISO 8601
?040506ISO 8601
?04:05 AMsame as 04:05; AM does not affect value
?04:05 PMsame as 16:05; input hour must be <= 12
?04:05:06.789-8ISO 8601
?04:05:06-08:00ISO 8601
?04:05-08:00ISO 8601
?040506-08ISO 8601
?04:05:06 PSTtime zone specified by abbreviation
?2003-04-12 04:05:06 America/New_Yorktime zone specified by full name

Time Zone Input

SupportedExampleDescription
?PSTAbbreviation (for Pacific Standard Time)
?America/New_YorkFull time zone name
?PST8PDTPOSIX-style time zone specification
?-8:00ISO-8601 offset for PST
?-800ISO-8601 offset for PST
?-8ISO-8601 offset for PST
?zuluMilitary abbreviation for UTC
?zShort form of zulu

Unix timestamp

The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch.

How to store unix timestamp in Postgres: 1 Storing as bigint 2 Cast with Postgres function to timestamp

  • To convert from Unix timestamp to timestamp: <br> SELECT to_timestamp(<Unix timestamp>);
  • To convert Unix timestamp to timestamptz: <br> SELECT timezone('US/Pacific', to_timestamp(<Unix timestamp>))
  • To convert from datetime to Unix timestamp: <br> SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '<timetamptz>');

Geometries

  • to handel PostGIS geometry the extension postgis has to be added as <br> CREATE EXTENSION IF NOT EXISTS postgis;.
  • Geometries are handled in StreamPipes in WKT notation and must to be stored together with an SRID (StreamPipes convention).
  • The used column name of the geometry are offen: geom or the_geom, but any other name will do it as well.
  • The universal type geometry can store all sub-types.
  • Sub-types can only stored the specified sub-type itself, otherwise a [null]-value will be stored instead of the real geometry.
SupportedTypePostGIS functionStreamPipes Domain
YesGeometryST_GeomFromText(text WKT, integer srid)http://www.opengis.net/ont/geosparql#Geometry
coming soonPointST_PointFromText(text WKT, integer srid);
coming soonLineStringST_LineFromText(text WKT, integer srid);
coming soonPolygonST_PolygonFromText(text WKT, integer srid);
coming soonMultiPointST_MPointFromText(text WKT, integer srid);
coming soonMultiLineStringST_MLineFromText(text WKT, integer srid);
coming soonMultiPolygonST_MPolyFromText(text WKT, integer srid);
coming soonGeometryCollectionST_GeomCollFromText(text WKT, integer srid);

Index in PostGIS

Indexes make using a spatial database for large data sets possible. Without indexing, any search for a feature would require a “sequential scan” of every record in the database. Indexing speeds up searching by organizing the data into a search tree which can be quickly traversed to find a particular record.

Index can be created with a simple query. The name of the index should be unique. Best practice is tablename_geomColumnName_idx.

CREATE INDEX [NAME OF THE INDEX]
ON [TABLENAME]
USING GIST ([GEOM-COLUMN]);

More Information about spatial Index:

Not supported types by StreamPipes

  1. Binary Data Types
  2. Monetary Types
  3. Enumerated Types
  4. Network Address Types
  5. Bit String Types
  6. Text Search Types
  7. XML Type
  8. Composite Types
  9. Domain Types
  10. Object Identifier Types
  11. pg_lsn Type
  12. Pseudo-Types
  13. Range Types
  14. JSON Types
  15. Arrays
  16. UUID Type
  • No labels