Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Type checking

    1 answers - 1192 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I have several user defined types with particular restraints
    upon the data they represent. If I have crafted my foo_in()
    function to ensure that these constraints are always satisfied
    *before* allowing a datum into the database AND I have designed
    my casts to be similarly vigilant, is there any THER way that
    data can creep into the database that is noncompliant?
    I.e., if I have a bunch of functions defined as taking an
    argument of type "foo", is there any way the user can pass
    a value to these functions WITHUT it going through my
    gatekeepers (foo_in(), foo_from_baz(), etc.)? ,
    the reason for my question is to verify that the functions
    that take foo arguments need not be concerned with verifying
    that their arguments are, in fact, compliant with the rules
    defined (enforced) for that type.
    E.g., if the foo type excludes the value '0', can I write
    a routine inverse(foo) that computes 1/x for any value of
    x without testing for x==0?
    <grimaceAm I being clear enough about the question I am
    asking? :-/
    Thanks!
    (end of broadcast)
    TIP 6: explain analyze is your friend
  • No.1 | | 580 bytes | |

    Don Y <pgsql (AT) DakotaCom (DOT) Netwrites:
    I.e., if I have a bunch of functions defined as taking an
    argument of type "foo", is there any way the user can pass
    a value to these functions WITHUT it going through my
    gatekeepers (foo_in(), foo_from_baz(), etc.)?

    No, not if foo is a separate type. Postgres has absolutely no knowledge
    of the internal representation of a base type, and will never manipulate
    it except through the routines you supply.

    regards, tom lane

    (end of broadcast)
    TIP 6: explain analyze is your friend

Re: Type checking


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Databases"

EMSDN.COM