Adding header nam to any table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Vodep

    Adding header nam to any table

    Hi!
    I am using postgresql with PHP and C. Is it possible to add header
    information to every table? For example:
    id | name | age
    should be
    User ID | Username | Age of user
    This should be displayed, when i query the header information. Is this
    possible? Maybe i can add a comment to every column header? Or is there a simple
    way for storeing this additional information in a other table and solve this
    problem by writting some special SQL statements?

    Thanks!!
    cu

    --
    COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
    --------------------------------------------------
    1. GMX TopMail - Platz 1 und Testsieger!
    2. GMX ProMail - Platz 2 und Preis-Qualitätssieger !
    3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


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

  • Richard Huxton

    #2
    Re: Adding header nam to any table

    On Tuesday 09 September 2003 16:49, Michael Vodep wrote:[color=blue]
    > Hi!
    > I am using postgresql with PHP and C. Is it possible to add header
    > information to every table? For example:
    > id | name | age
    > should be
    > User ID | Username | Age of user
    > This should be displayed, when i query the header information. Is this
    > possible? Maybe i can add a comment to every column header? Or is there a
    > simple way for storeing this additional information in a other table and
    > solve this problem by writting some special SQL statements?[/color]

    Well, one solution which I tend to use is to keep this information in my
    application layer (PHP/C in your case).

    Since PHP will need to know something about the structure of the database
    anyway, I keep all this together. Something like:

    $Tables['user_age'] = array(
    'id' => array('type' => 'int', 'desc'=>'User ID'),
    'name' => array( 'type'=>'text', 'desc'=>'User name' ),
    'age' => array('type'=>' int', 'desc'=>'Age of user' )
    );

    In fact, where possible I like to generate the above table and my SQL from the
    same definitions-file.

    --
    Richard Huxton
    Archonet Ltd

    ---------------------------(end of broadcast)---------------------------
    TIP 6: Have you searched our list archives?



    Comment

    • Ron Johnson

      #3
      Re: Adding header nam to any table

      On Tue, 2003-09-09 at 10:49, Michael Vodep wrote:[color=blue]
      > Hi!
      > I am using postgresql with PHP and C. Is it possible to add header
      > information to every table? For example:
      > id | name | age
      > should be
      > User ID | Username | Age of user[/color]

      In psql, you can do:
      SELECT id as "User ID", name as "Username", age as "Age of user"
      FROM foobar;

      A special table where you manually map field names to descriptive
      would also work, and be generic.

      --
      -----------------------------------------------------------------
      Ron Johnson, Jr. ron.l.johnson@c ox.net
      Jefferson, LA USA

      "Fair is where you take your cows to be judged."
      Unknown


      ---------------------------(end of broadcast)---------------------------
      TIP 1: subscribe and unsubscribe commands go to majordomo@postg resql.org

      Comment

      Working...