Search Postgresql Archives

Re: Insert UUID GEN 4 Value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 30, 2018 at 9:32 PM, tango ward <tangoward15@xxxxxxxxx> wrote:

On Thu, May 31, 2018 at 12:18 PM, David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:
On Wednesday, May 30, 2018, tango ward <tangoward15@xxxxxxxxx> wrote:
Okay I will try it.

When I tried it, I am getting an error:
​​
Invalid input syntax for UUID: uuid_generate_v4(),

Avoid references to "it" and just show the code you tried to run.

David J.


I'm testing this code:

curr_pgsql.execute('''CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; ''')
curr_pgsql.execute('''
                    INSERT INTO enrollmentinfo (
                                                         created, modified,
                                                         secure_id,
                                                         relationship,
                                                         tuition_bill,
                                                         cashier_name,
                                                         cashier_phone_number
                                                         )
                    VALUES (current_timestamp, current_timestamp,
                            uuid_generate_v4(), '', '', '',)
                                                         ''')

​Executing this query is psql does not give the error​: ​Invalid input syntax for UUID: uuid_generate_v4(),

This query is almost correct except you have a trailing comma in your VALUES statement that is going to provoke: syntax error near "," (i.e., you haven't provided a value for cashier_phone_number)

The query, which you have not yet shown, that provoked the "Invalid input syntax for UUID: uuid_generate_v4()" must have had the function call specified within single quotes in order for the server to think it was a literal value instead of an _expression_ to be evaluated.

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux