pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedInsert UUID GEN 4 Value
21+ messages / 9 participants
[nested] [flat]
* Insert UUID GEN 4 Value
@ 2018-05-31 03:24 tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 14:22 ` Re: Insert UUID GEN 4 Value Dennis Gearon <gearond@sbcglobal.net>
0 siblings, 2 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 03:24 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi,
I would like to know how to properly use uuid_generate_v4 when inserting
data into PostgreSQL table.
When I run the command select * from pg_available_extensions;
I can see this uuid-ossp | 1.0 | |
generate universally unique identifiers (UUIDs)
I am trying to find a basic and easy to understand documentation of it on
how to use when inserting data because I have a column that is a uuid type.
Thanks,
J
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 03:41 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: Laurenz Albe @ 2018-05-31 03:41 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
tango ward wrote:
> I would like to know how to properly use uuid_generate_v4 when inserting data into PostgreSQL table.
>
> When I run the command select * from pg_available_extensions;
> I can see this uuid-ossp | 1.0 | | generate universally unique identifiers (UUIDs)
>
> I am trying to find a basic and easy to understand documentation of it on how to use
> when inserting data because I have a column that is a uuid type.
Are you looking for this?
ALTER TABLE tab ALTER col SET DEFAULT uuid_generate_v1();
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
@ 2018-05-31 03:47 ` tango ward <tangoward15@gmail.com>
2018-05-31 03:48 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 2 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 03:47 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi,
thanks.
I found this:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
SELECT uuid_generate_v4();
My problem is I have a table like this:
CREATE TABLE enrollmentinfo (
id integer NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
secure_id uuid NOT NULL,
relationship character varying(50) NOT NULL,
tuition_bill character varying(255) NOT NULL
);
Now I need to insert data into this table, I just don't know if I can use
something like this "INSERT INTO enrollmentinfo (current_timestamp,
current_timestamp, uuid_generate_v4(), '', ''); I haven't tried this but
also not sure if I can call the function inside INSERT.
On Thu, May 31, 2018 at 11:41 AM, Laurenz Albe <laurenz.albe@cybertec.at>
wrote:
> tango ward wrote:
> > I would like to know how to properly use uuid_generate_v4 when inserting
> data into PostgreSQL table.
> >
> > When I run the command select * from pg_available_extensions;
> > I can see this uuid-ossp | 1.0 |
> | generate universally unique identifiers (UUIDs)
> >
> > I am trying to find a basic and easy to understand documentation of it
> on how to use
> > when inserting data because I have a column that is a uuid type.
>
> Are you looking for this?
>
> ALTER TABLE tab ALTER col SET DEFAULT uuid_generate_v1();
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 03:48 ` tango ward <tangoward15@gmail.com>
1 sibling, 0 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 03:48 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 11:47 AM, tango ward <tangoward15@gmail.com> wrote:
> Hi,
>
> thanks.
>
> I found this:
>
> CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
> SELECT uuid_generate_v4();
>
> My problem is I have a table like this:
> CREATE TABLE enrollmentinfo (
> id integer NOT NULL,
> created timestamp with time zone NOT NULL,
> modified timestamp with time zone NOT NULL,
> secure_id uuid NOT NULL,
> relationship character varying(50) NOT NULL,
> tuition_bill character varying(255) NOT NULL
> );
>
> Now I need to insert data into this table, I just don't know if I can use
> something like this "INSERT INTO enrollmentinfo (current_timestamp,
> current_timestamp, uuid_generate_v4(), '', ''); I haven't tried this but
> also not sure if I can call the function inside INSERT.
>
>
>
>
> On Thu, May 31, 2018 at 11:41 AM, Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>
>> tango ward wrote:
>> > I would like to know how to properly use uuid_generate_v4 when
>> inserting data into PostgreSQL table.
>> >
>> > When I run the command select * from pg_available_extensions;
>> > I can see this uuid-ossp | 1.0 |
>> | generate universally unique identifiers (UUIDs)
>> >
>> > I am trying to find a basic and easy to understand documentation of it
>> on how to use
>> > when inserting data because I have a column that is a uuid type.
>>
>> Are you looking for this?
>>
>> ALTER TABLE tab ALTER col SET DEFAULT uuid_generate_v1();
>>
>> Yours,
>> Laurenz Albe
>> --
>> Cybertec | https://www.cybertec-postgresql.com
>
>
sorry, I should be following bottom-post.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 03:51 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: Laurenz Albe @ 2018-05-31 03:51 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
tango ward wrote:
> I found this:
>
> CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
> SELECT uuid_generate_v4();
>
> My problem is I have a table like this:
> CREATE TABLE enrollmentinfo (
> id integer NOT NULL,
> created timestamp with time zone NOT NULL,
> modified timestamp with time zone NOT NULL,
> secure_id uuid NOT NULL,
> relationship character varying(50) NOT NULL,
> tuition_bill character varying(255) NOT NULL
> );
>
> Now I need to insert data into this table, I just don't know if I can use something like this
> "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp, uuid_generate_v4(), '', '');
> I haven't tried this but also not sure if I can call the function inside INSERT.
Why didn't you try it?
I see no problem with that.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
@ 2018-05-31 03:53 ` tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
0 siblings, 1 reply; 21+ messages in thread
From: tango ward @ 2018-05-31 03:53 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe <laurenz.albe@cybertec.at>
wrote:
> tango ward wrote:
> > I found this:
> >
> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
> > SELECT uuid_generate_v4();
> >
> > My problem is I have a table like this:
> > CREATE TABLE enrollmentinfo (
> > id integer NOT NULL,
> > created timestamp with time zone NOT NULL,
> > modified timestamp with time zone NOT NULL,
> > secure_id uuid NOT NULL,
> > relationship character varying(50) NOT NULL,
> > tuition_bill character varying(255) NOT NULL
> > );
> >
> > Now I need to insert data into this table, I just don't know if I can
> use something like this
> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp,
> uuid_generate_v4(), '', '');
> > I haven't tried this but also not sure if I can call the function inside
> INSERT.
>
> Why didn't you try it?
>
> I see no problem with that.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>
Okay I will try it.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 03:57 ` tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 2 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 03:57 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 11:53 AM, tango ward <tangoward15@gmail.com> wrote:
> On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>
>> tango ward wrote:
>> > I found this:
>> >
>> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
>> > SELECT uuid_generate_v4();
>> >
>> > My problem is I have a table like this:
>> > CREATE TABLE enrollmentinfo (
>> > id integer NOT NULL,
>> > created timestamp with time zone NOT NULL,
>> > modified timestamp with time zone NOT NULL,
>> > secure_id uuid NOT NULL,
>> > relationship character varying(50) NOT NULL,
>> > tuition_bill character varying(255) NOT NULL
>> > );
>> >
>> > Now I need to insert data into this table, I just don't know if I can
>> use something like this
>> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp,
>> uuid_generate_v4(), '', '');
>> > I haven't tried this but also not sure if I can call the function
>> inside INSERT.
>>
>> Why didn't you try it?
>>
>> I see no problem with that.
>>
>> Yours,
>> Laurenz Albe
>> --
>> Cybertec | https://www.cybertec-postgresql.com
>>
>>
>
> Okay I will try it.
>
When I tried it, I am getting an error: Invalid input syntax for UUID:
uuid_generate_v4(),
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 04:06 ` Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: Rob Sargent @ 2018-05-31 04:06 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
> On May 30, 2018, at 9:57 PM, tango ward <tangoward15@gmail.com> wrote:
>
>> On Thu, May 31, 2018 at 11:53 AM, tango ward <tangoward15@gmail.com> wrote:
>>> On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>>> tango ward wrote:
>>> > I found this:
>>> >
>>> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
>>> > SELECT uuid_generate_v4();
>>> >
>>> > My problem is I have a table like this:
>>> > CREATE TABLE enrollmentinfo (
>>> > id integer NOT NULL,
>>> > created timestamp with time zone NOT NULL,
>>> > modified timestamp with time zone NOT NULL,
>>> > secure_id uuid NOT NULL,
>>> > relationship character varying(50) NOT NULL,
>>> > tuition_bill character varying(255) NOT NULL
>>> > );
>>> >
>>> > Now I need to insert data into this table, I just don't know if I can use something like this
>>> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp, uuid_generate_v4(), '', '');
>>> > I haven't tried this but also not sure if I can call the function inside INSERT.
>>>
>>> Why didn't you try it?
>>>
>>> I see no problem with that.
>>>
>>> Yours,
>>> Laurenz Albe
>>> --
>>> Cybertec | https://www.cybertec-postgresql.com
>>>
>>
>>
>> Okay I will try it.
>
> When I tried it, I am getting an error: Invalid input syntax for UUID: uuid_generate_v4(),
What do you get from
Select uuid_generate_v4();=
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
@ 2018-05-31 04:45 ` tango ward <tangoward15@gmail.com>
2018-05-31 12:36 ` Re: Insert UUID GEN 4 Value C GG <cgg0007@gmail.com>
2018-05-31 13:13 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 04:45 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 12:06 PM, Rob Sargent <robjsargent@gmail.com> wrote:
>
>
> On May 30, 2018, at 9:57 PM, tango ward <tangoward15@gmail.com> wrote:
>
> On Thu, May 31, 2018 at 11:53 AM, tango ward <tangoward15@gmail.com>
> wrote:
>
>> On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe <laurenz.albe@cybertec.at>
>> wrote:
>>
>>> tango ward wrote:
>>> > I found this:
>>> >
>>> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
>>> > SELECT uuid_generate_v4();
>>> >
>>> > My problem is I have a table like this:
>>> > CREATE TABLE enrollmentinfo (
>>> > id integer NOT NULL,
>>> > created timestamp with time zone NOT NULL,
>>> > modified timestamp with time zone NOT NULL,
>>> > secure_id uuid NOT NULL,
>>> > relationship character varying(50) NOT NULL,
>>> > tuition_bill character varying(255) NOT NULL
>>> > );
>>> >
>>> > Now I need to insert data into this table, I just don't know if I can
>>> use something like this
>>> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp,
>>> uuid_generate_v4(), '', '');
>>> > I haven't tried this but also not sure if I can call the function
>>> inside INSERT.
>>>
>>> Why didn't you try it?
>>>
>>> I see no problem with that.
>>>
>>> Yours,
>>> Laurenz Albe
>>> --
>>> Cybertec | https://www.cybertec-postgresql.com
>>>
>>>
>>
>> Okay I will try it.
>>
>
> When I tried it, I am getting an error: Invalid input syntax for UUID:
> uuid_generate_v4(),
>
> What do you get from
> Select uuid_generate_v4();
>
If I try these in psql, CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; SELECT
uuid_generate_v4();
I am getting the generated code but I dunno how to use this in INSERT
statement. I am getting an error of invalid input systex for UUID.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 12:36 ` C GG <cgg0007@gmail.com>
2018-05-31 13:11 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 1 reply; 21+ messages in thread
From: C GG @ 2018-05-31 12:36 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; +Cc: Rob Sargent <robjsargent@gmail.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 12:45 AM, tango ward <tangoward15@gmail.com> wrote:
> On Thu, May 31, 2018 at 12:06 PM, Rob Sargent <robjsargent@gmail.com>
> wrote:
>
>>
>>
>> On May 30, 2018, at 9:57 PM, tango ward <tangoward15@gmail.com> wrote:
>>
>> On Thu, May 31, 2018 at 11:53 AM, tango ward <tangoward15@gmail.com>
>> wrote:
>>
>>> On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe <laurenz.albe@cybertec.at
>>> > wrote:
>>>
>>>> tango ward wrote:
>>>> > I found this:
>>>> >
>>>> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
>>>> > SELECT uuid_generate_v4();
>>>> >
>>>> > My problem is I have a table like this:
>>>> > CREATE TABLE enrollmentinfo (
>>>> > id integer NOT NULL,
>>>> > created timestamp with time zone NOT NULL,
>>>> > modified timestamp with time zone NOT NULL,
>>>> > secure_id uuid NOT NULL,
>>>> > relationship character varying(50) NOT NULL,
>>>> > tuition_bill character varying(255) NOT NULL
>>>> > );
>>>> >
>>>> > Now I need to insert data into this table, I just don't know if I can
>>>> use something like this
>>>> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp,
>>>> uuid_generate_v4(), '', '');
>>>> > I haven't tried this but also not sure if I can call the function
>>>> inside INSERT.
>>>>
>>>> Why didn't you try it?
>>>>
>>>> I see no problem with that.
>>>>
>>>> Yours,
>>>> Laurenz Albe
>>>> --
>>>> Cybertec | https://www.cybertec-postgresql.com
>>>>
>>>>
>>>
>>> Okay I will try it.
>>>
>>
>> When I tried it, I am getting an error: Invalid input syntax for UUID:
>> uuid_generate_v4(),
>>
>> What do you get from
>> Select uuid_generate_v4();
>>
>
> If I try these in psql, CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; SELECT
> uuid_generate_v4();
>
> I am getting the generated code but I dunno how to use this in INSERT
> statement. I am getting an error of invalid input systex for UUID.
>
Hello,
Using INSERT (..) VALUES (..) won't execute functions. It expects literal
values. Instead do something like
INSERT INTO enrollmentinfo (id, created, modified, secure_id, relationship,
tuition_bill) SELECT your_id_returning_function_or_a_literal_value(),
current_timestamp, current_timestamp, uuid_generate_v4(), 'some
relationship', 'some tuition bill text';
...modified with real values, of course...
That should get you over the hump. Good luck on your project!
CG
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 12:36 ` Re: Insert UUID GEN 4 Value C GG <cgg0007@gmail.com>
@ 2018-05-31 13:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 13:39 ` Re: Insert UUID GEN 4 Value Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 21+ messages in thread
From: Adrian Klaver @ 2018-05-31 13:11 UTC (permalink / raw)
To: C GG <cgg0007@gmail.com>; tango ward <tangoward15@gmail.com>; +Cc: Rob Sargent <robjsargent@gmail.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 05/31/2018 05:36 AM, C GG wrote:
>
> On Thu, May 31, 2018 at 12:45 AM, tango ward <tangoward15@gmail.com
> <mailto:tangoward15@gmail.com>> wrote:
>
> On Thu, May 31, 2018 at 12:06 PM, Rob Sargent <robjsargent@gmail.com
> <mailto:robjsargent@gmail.com>> wrote:
>
>
>
> On May 30, 2018, at 9:57 PM, tango ward <tangoward15@gmail.com
> <mailto:tangoward15@gmail.com>> wrote:
>
>> On Thu, May 31, 2018 at 11:53 AM, tango ward
>> <tangoward15@gmail.com <mailto:tangoward15@gmail.com>> wrote:
>>
>> On Thu, May 31, 2018 at 11:51 AM, Laurenz Albe
>> <laurenz.albe@cybertec.at
>> <mailto:laurenz.albe@cybertec.at>> wrote:
>>
>> tango ward wrote:
>> > I found this:
>> >
>> > CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
>> > SELECT uuid_generate_v4();
>> >
>> > My problem is I have a table like this:
>> > CREATE TABLE enrollmentinfo (
>> > id integer NOT NULL,
>> > created timestamp with time zone NOT NULL,
>> > modified timestamp with time zone NOT NULL,
>> > secure_id uuid NOT NULL,
>> > relationship character varying(50) NOT NULL,
>> > tuition_bill character varying(255) NOT NULL
>> > );
>> >
>> > Now I need to insert data into this table, I just don't know if I can use something like this
>> > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp, uuid_generate_v4(), '', '');
>> > I haven't tried this but also not sure if I can call the function inside INSERT.
>>
>> Why didn't you try it?
>>
>> I see no problem with that.
>>
>> Yours,
>> Laurenz Albe
>> --
>> Cybertec | https://www.cybertec-postgresql.com
>>
>> <https://www.cybertec-postgresql.com;
>>
>>
>>
>> Okay I will try it.
>>
>>
>> When I tried it, I am getting an error: Invalid input syntax
>> for UUID: uuid_generate_v4(),
> What do you get from
> Select uuid_generate_v4();
>
>
> If I try these in psql, CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
> SELECT uuid_generate_v4();
>
> I am getting the generated code but I dunno how to use this in
> INSERT statement. I am getting an error of invalid input systex for
> UUID.
>
>
> Hello,
>
> Using INSERT (..) VALUES (..) won't execute functions. It expects
> literal values. Instead do something like
That is not the case:
https://www.postgresql.org/docs/10/static/sql-insert.html
"VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
...
expression
An expression or value to assign to the corresponding column.
"
\d ts_tsz_test
Table "public.ts_tsz_test"
Column | Type | Collation | Nullable | Default
--------+-----------------------------+-----------+----------+---------
fld_1 | timestamp without time zone | | |
fld_2 | timestamp with time zone | | |
fld_3 | integer | | |
CREATE OR REPLACE FUNCTION public.test_fnc()
RETURNS integer
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN 2;
END;
$function$
insert into ts_tsz_test values (localtimestamp(2), current_timestamp(2),
test_fnc());
INSERT 0 1
select * from ts_tsz_test ;
fld_1 | fld_2 | fld_3
------------------------+---------------------------+-------
2018-05-31 06:06:39.71 | 2018-05-31 06:06:39.71-07 | 2
My suspicion is it had to do with this from a post upstream:
"When I tried it, I am getting an error: Invalid input syntax for UUID:
uuid_generate_v4(),"
Namely the output of the function is not meeting the input syntax for
the uuid field.
>
> INSERT INTO enrollmentinfo (id, created, modified, secure_id,
> relationship, tuition_bill) SELECT
> your_id_returning_function_or_a_literal_value(), current_timestamp,
> current_timestamp, uuid_generate_v4(), 'some relationship', 'some
> tuition bill text';
>
> ...modified with real values, of course...
>
> That should get you over the hump. Good luck on your project!
>
> CG
>
>
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 12:36 ` Re: Insert UUID GEN 4 Value C GG <cgg0007@gmail.com>
2018-05-31 13:11 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
@ 2018-05-31 13:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-05-31 14:23 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 21+ messages in thread
From: Tom Lane @ 2018-05-31 13:39 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: C GG <cgg0007@gmail.com>; tango ward <tangoward15@gmail.com>; Rob Sargent <robjsargent@gmail.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> My suspicion is it had to do with this from a post upstream:
> "When I tried it, I am getting an error: Invalid input syntax for UUID:
> uuid_generate_v4(),"
Yeah. We haven't seen the actual query yet, but I'm betting the OP
really wrote
INSERT ... , 'uuid_generate_v4()', ...
not
INSERT ... , uuid_generate_v4(), ...
There might be some layers of client-side parameter mangling obscuring
what's actually happening.
regards, tom lane
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 12:36 ` Re: Insert UUID GEN 4 Value C GG <cgg0007@gmail.com>
2018-05-31 13:11 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 13:39 ` Re: Insert UUID GEN 4 Value Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-05-31 14:23 ` Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 21+ messages in thread
From: Adrian Klaver @ 2018-05-31 14:23 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: C GG <cgg0007@gmail.com>; tango ward <tangoward15@gmail.com>; Rob Sargent <robjsargent@gmail.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 05/31/2018 06:39 AM, Tom Lane wrote:
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>> My suspicion is it had to do with this from a post upstream:
>> "When I tried it, I am getting an error: Invalid input syntax for UUID:
>> uuid_generate_v4(),"
>
> Yeah. We haven't seen the actual query yet, but I'm betting the OP
> really wrote
>
> INSERT ... , 'uuid_generate_v4()', ...
>
> not
>
> INSERT ... , uuid_generate_v4(), ...
>
> There might be some layers of client-side parameter mangling obscuring
> what's actually happening.
I would tend to agree:
\d uuid_test
Table "public.uuid_test"
Column | Type | Collation | Nullable | Default
----------+------+-----------+----------+---------
uuid_fld | uuid |
insert into uuid_test values (uuid_generate_v4());
INSERT 0 1
select * from uuid_test ;
uuid_fld
--------------------------------------
f4bc853b-0c05-437b-904a-825cc6d3ea7b
In Python(using psycopg2) which is what the OP is using;
cur.execute("INSERT INTO uuid_test values(uuid_generate_v4())")
con.commit()
cur.execute("SELECT uuid_fld FROM uuid_test")
rs = cur.fetchall()
rs
[('f4bc853b-0c05-437b-904a-825cc6d3ea7b',),
('9e55f5ea-c504-4847-8674-05202ec499c6',)]
From this post:
https://www.postgresql.org/message-id/CAA6wQLLVpjtxAhPy3K1f63WtvqjK4QrzBLKjeh0PDUOyCvbT2Q%40mail.gma...
the OP seems to be on the right track. So something else is happening.
>
> regards, tom lane
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Re: Insert UUID GEN 4 Value Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 13:13 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 21+ messages in thread
From: Adrian Klaver @ 2018-05-31 13:13 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; Rob Sargent <robjsargent@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 05/30/2018 09:45 PM, tango ward wrote:
> On Thu, May 31, 2018 at 12:06 PM, Rob Sargent <robjsargent@gmail.com
> <mailto:robjsargent@gmail.com>> wrote:
>
>
> If I try these in psql, CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
> SELECT uuid_generate_v4();
>
> I am getting the generated code but I dunno how to use this in INSERT
> statement. I am getting an error of invalid input systex for UUID.
So please show what:
SELECT uuid_generate_v4();
is actually returning.
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 04:18 ` David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: David G. Johnston @ 2018-05-31 04:18 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wednesday, May 30, 2018, tango ward <tangoward15@gmail.com> 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.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
@ 2018-05-31 04:32 ` tango ward <tangoward15@gmail.com>
2018-05-31 14:33 ` Re: Insert UUID GEN 4 Value Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 15:25 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 2 replies; 21+ messages in thread
From: tango ward @ 2018-05-31 04:32 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 12:18 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:
> On Wednesday, May 30, 2018, tango ward <tangoward15@gmail.com> 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(), '', '', '',)
''')
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 14:33 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 21+ messages in thread
From: Adrian Klaver @ 2018-05-31 14:33 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; David G. Johnston <david.g.johnston@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 05/30/2018 09:32 PM, tango ward wrote:
>
>
> 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(), '', '', '',)
> ''')
I just noticed something, the fields you show above do not match the
description of the table you showed here:
https://www.postgresql.org/message-id/CAA6wQLJr6fjzx%2BZK6N4yiViZYdFuGGkMT27zsp-mR1SjAzbGEg%40mail.g...
CREATE TABLE enrollmentinfo (
id integer NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
secure_id uuid NOT NULL,
relationship character varying(50) NOT NULL,
tuition_bill character varying(255) NOT NULL
);
So which is correct?
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 15:25 ` David G. Johnston <david.g.johnston@gmail.com>
2018-06-01 00:39 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: David G. Johnston @ 2018-05-31 15:25 UTC (permalink / raw)
To: tango ward <tangoward15@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, May 30, 2018 at 9:32 PM, tango ward <tangoward15@gmail.com> wrote:
>
> On Thu, May 31, 2018 at 12:18 PM, David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>> On Wednesday, May 30, 2018, tango ward <tangoward15@gmail.com> 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.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 15:25 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
@ 2018-06-01 00:39 ` tango ward <tangoward15@gmail.com>
2018-06-01 01:10 ` Re: Insert UUID GEN 4 Value Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 21+ messages in thread
From: tango ward @ 2018-06-01 00:39 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, May 31, 2018 at 12:32 PM, tango ward <tangoward15@gmail.com> wrote:
>
> On Thu, May 31, 2018 at 12:18 PM, David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>> On Wednesday, May 30, 2018, tango ward <tangoward15@gmail.com> 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(), '', '', '',)
> ''')
>
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(), '', '', '',)
''')
Hi, this is the query that I am trying to run. I'll try your suggestions
when I arrived in the office.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Re: Insert UUID GEN 4 Value Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 04:18 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 15:25 ` Re: Insert UUID GEN 4 Value David G. Johnston <david.g.johnston@gmail.com>
2018-06-01 00:39 ` Re: Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-06-01 01:10 ` Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 21+ messages in thread
From: Ron @ 2018-06-01 01:10 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 05/31/2018 07:39 PM, tango ward wrote:
> On Thu, May 31, 2018 at 12:32 PM, tango ward <tangoward15@gmail.com
> <mailto:tangoward15@gmail.com>> wrote:
>
>
> On Thu, May 31, 2018 at 12:18 PM, David G. Johnston
> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>> wrote:
>
> On Wednesday, May 30, 2018, tango ward <tangoward15@gmail.com
> <mailto:tangoward15@gmail.com>> 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(), '', '', '',)
> ''')
>
>
> 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(), '', '', '',)
> ''')
>
>
> Hi, this is the query that I am trying to run. I'll try your suggestions
> when I arrived in the office.
Honestly, I'd try it in psql first. That will eliminate all possible
problems due to quoting errors, etc.
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Insert UUID GEN 4 Value
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
@ 2018-05-31 14:22 ` Dennis Gearon <gearond@sbcglobal.net>
1 sibling, 0 replies; 21+ messages in thread
From: Dennis Gearon @ 2018-05-31 14:22 UTC (permalink / raw)
To: tangoward15@gmail.com <tangoward15@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Sent from Yahoo Mail on Android
On Wed, May 30, 2018 at 8:25 PM, tango ward<tangoward15@gmail.com> wrote: Hi,
I would like to know how to properly use uuid_generate_v4 when inserting data into PostgreSQL table.
When I run the command select * from pg_available_extensions;I can see this uuid-ossp | aqaaQaaaaaaaaAaaaaaaaaaaaaaaaaaaaaaaa | | generate universally unique identifiers (UUIDs)
I am trying to find a basic and easy to understand documentation of it on how to use when inserting data AAAAAAAAAAaaaaa I have a column that is a uuid type.
ZzzzzzzzzzzsssSSaaAaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaaaaaaAaAaaAaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAASThanks,J
^ permalink raw reply [nested|flat] 21+ messages in thread
end of thread, other threads:[~2018-06-01 01:10 UTC | newest]
Thread overview: 21+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 03:24 Insert UUID GEN 4 Value tango ward <tangoward15@gmail.com>
2018-05-31 03:41 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:47 ` tango ward <tangoward15@gmail.com>
2018-05-31 03:48 ` tango ward <tangoward15@gmail.com>
2018-05-31 03:51 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-05-31 03:53 ` tango ward <tangoward15@gmail.com>
2018-05-31 03:57 ` tango ward <tangoward15@gmail.com>
2018-05-31 04:06 ` Rob Sargent <robjsargent@gmail.com>
2018-05-31 04:45 ` tango ward <tangoward15@gmail.com>
2018-05-31 12:36 ` C GG <cgg0007@gmail.com>
2018-05-31 13:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 13:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-05-31 14:23 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 13:13 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 04:18 ` David G. Johnston <david.g.johnston@gmail.com>
2018-05-31 04:32 ` tango ward <tangoward15@gmail.com>
2018-05-31 14:33 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-05-31 15:25 ` David G. Johnston <david.g.johnston@gmail.com>
2018-06-01 00:39 ` tango ward <tangoward15@gmail.com>
2018-06-01 01:10 ` Ron <ronljohnsonjr@gmail.com>
2018-05-31 14:22 ` Dennis Gearon <gearond@sbcglobal.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox