There are three implicitly typed
constants for use in Postgres:
strings, integers, and floating point numbers. Constants can also
be specified with explicit types, which can enable more accurate
representation and more efficient handling by the backend. The
implicit constants are described below; explicit constants are
discussed afterwards.

Strings in SQL are arbitrary sequences
of ASCII characters bounded by single quotes ("'", e.g. 'This is a string'). SQL92 allows single quotes to
be embedded in strings by typing two adjacent single quotes (e.g.
'Dianne''s horse'). In Postgres single quotes may alternatively be
escaped with a backslash ("\", e.g. 'Dianne\'s
horse'). To include a backslash in a string constant, type two
backslashes. Non-printing characters may also be embedded within
strings by prepending them with a backslash (e.g. '\tab').

Floating point constants consist of an
integer part, a decimal point, and a fraction part or scientific
notation of the following format:

{dig}.{dig} [e [+-] {dig}]

where dig is one or more
digits. You must include at least one dig after the period and after the [+-] if
you use those options. An exponent with a missing mantissa has a
mantissa of 1 inserted. There may be no extra characters embedded
in the string.

Floating point constaints are of type float8. float4 can be
specified explicitly by using SQL92
string notation or Postgres type
notation:

A constant of an arbitrary type can be
entered using any one of the following notations:

type 'string'
'string'::type
CAST 'string' AS type

The value inside the string is passed to the input conversion
routine for the type called type.
The result is a constant of the indicated type. The explicit
typecast may be omitted if there is no ambiguity as to the type the
constant must be, in which case it is automatically coerced.