Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2007
    Posts
    5

    Unanswered: Migrating to pgsql

    hi all

    i have a large database in mysql
    and i want to use pgsql

    but i have some functions in mysql which i can't find in pgsql

    like adddate
    how can i do the some with pgsql extract function (or something else?) like adddate do in mysql (http://dev.mysql.com/doc/refman/5.0/...functions.html)

    thanks!

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    For adddate use the + operator as described in:

    http://www.postgresql.org/docs/8.2/s...-datetime.html

    The full list of functions supported is here:

    http://www.postgresql.org/docs/8.2/s...functions.html

  3. #3
    Join Date
    Mar 2007
    Posts
    5
    It works.
    Thanks.

  4. #4
    Join Date
    Mar 2007
    Posts
    5
    hi

    2 other questions:

    php has mysql_insert_id() mysql function (http://hu.php.net/manual/en/function...-insert-id.php)
    return with the last inserted ID

    - which pgsql php function do that?

    and i have an error:
    pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UNICODE": 0x88

    when i try to insert something, unicode string i get this error

    the string looks like: 8|LfnK#L;-R

    why it is?
    (if need more information tell me)

    thanks !
    (sorry for my bad English)

  5. #5
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    I ASSUME that you are using a serial field data type in your table. There will be an associated SEQUENCE.

    Refer to CurrVal(SequenceName) to return the current value of the sequence used in this last insert of the current session.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  6. #6
    Join Date
    Mar 2007
    Posts
    5
    Okay, i will try it.

    What about bad UNICODE ?
    Where should i search the problem ?

  7. #7
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    What is your database encoding?

    Have you looked at the PostgreSQL Mailing List archives?
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  8. #8
    Join Date
    Mar 2007
    Posts
    5
    UNICODE

    that is why i don't understand what the problem

    my mysql db is unicode too
    exported it and imported to pgsql every character is good
    but when i try to insert a new row i get that problem

    maybe my php code wrong?
    but if is, why can i insert to mysql and can't insert to pgsql?

    tried to search in mailing list, but the solution is always was: conert to UNICODE ..
    but i already in unicode

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •