Skip to main content
typo
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

Assign the variable at declaration time if it's known at declaration time. Else it's initialized with NULL and you need another statement to assign it. A small waste of code and performance.

DO
$$
DECLARE
   dateval date[] := '{2015-4-12, 2015-4-19}';
BEGIN
   -- do something
END
$$;

You just need the right syntax for either aan array literal or an ARRAY constructor.

The string literal above needs no explicit cast, since the type is defined in the assignment implicitly.

Related:

Assign the variable at declaration time if it's known at declaration time. Else it's initialized with NULL and you need another statement to assign it. A small waste of code and performance.

DO
$$
DECLARE
   dateval date[] := '{2015-4-12, 2015-4-19}';
BEGIN
   -- do something
END
$$;

You just need the right syntax for either a array literal or an ARRAY constructor.

The string literal above needs no explicit cast, since the type is defined in the assignment implicitly.

Related:

Assign the variable at declaration time if it's known at declaration time. Else it's initialized with NULL and you need another statement to assign it. A small waste of code and performance.

DO
$$
DECLARE
   dateval date[] := '{2015-4-12, 2015-4-19}';
BEGIN
   -- do something
END
$$;

You just need the right syntax for either an array literal or an ARRAY constructor.

The string literal above needs no explicit cast, since the type is defined in the assignment implicitly.

Related:

Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

Assign the variable at declaration time if it's known at declaration time. Else it's initialized with NULL and you need another statement to assign it. A small waste of code and performance.

DO
$$
DECLARE
   dateval date[] := '{2015-4-12, 2015-4-19}';
BEGIN
   -- do something
END
$$;

You just need the right syntax for either a array literal or an ARRAY constructor.

The string literal above needs no explicit cast, since the type is defined in the assignment implicitly.

Related: