domain type and array, is it possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pavel Stehule

    domain type and array, is it possible?

    Hello

    Can I use domain in array. I want to save "xml normalized string"
    into array.

    CREATE OR REPLACE FUNCTION normString(varc har) RETURNS bool AS '
    SELECT $1 !~ ''[\r\t\n]'';
    ' LANGUAGE sql;

    CREATE OR REPLACE FUNCTION chLength(varcha r, integer, integer) RETURNS
    bool AS '
    SELECT length($1) BETWEEN $2 AND $3;
    ' LANGUAGE sql;

    CREATE DOMAIN optPostalLineTy pe AS varchar(255)
    CHECK(normStrin g(value) AND chLength(value, 255));

    CREATE TABLE addresses (
    id serial primary key,
    tbl char(1) NOT NULL CHECK (tbl IN ('s')),
    type postalInfoEnumT ype,
    street optPostalLineTy pe[3] NULL,
    city postalLineType,
    zip zipType,
    country countryType NULL
    )

    but I get message ERROR: type "optpostallinet ype[]" does not exist.
    Is it possible combine DOMAIN and array?

    Thank You
    Pavel Stehule
    p.s. I use CVS PostgreSQL








    ---------------------------(end of broadcast)---------------------------
    TIP 5: Have you checked our extensive FAQ?



  • Kris Jurka

    #2
    Re: domain type and array, is it possible?



    On Mon, 10 May 2004, Pavel Stehule wrote:
    [color=blue]
    > Hello
    >
    > Can I use domain in array. I want to save "xml normalized string"
    > into array.
    >[/color]

    No, you can't have arrays of domains. See this recent -hackers message
    for why.

    > Is there any reason why a domain cannot use another domain as it's base > type? It hasn't been …


    Kris Jurka

    ---------------------------(end of broadcast)---------------------------
    TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddres sHere" to majordomo@postg resql.org)

    Comment

    Working...