Re: schema prefixes in default values (was RE: removing "serial" from table definitions).

2021-06-28 Thread Tom Lane
Marc Mamin writes: > it seems that our problem had nothing to do with serial, but with the way > schema prefixes are handled in column default values. > pg_attrdef.adsrc: > filled when the defaut value is defined. contains a schema prefix only when > required at this creation time. Is constan

schema prefixes in default values (was RE: removing "serial" from table definitions).

2021-06-28 Thread Marc Mamin
Marc Mamin writes: > > Yes, I undersand that serial is just a hint at table creation time, but is > > there a place in catalog where we can see if the table was created using > > 'serial' ? > > No. Where the docs say "these are equivalent", they mean that very literally. > > > The difference

Re: removing "serial" from table definitions.

2021-06-24 Thread Tom Lane
Marc Mamin writes: > Yes, I undersand that serial is just a hint at table creation time, but is > there a place in catalog where we can see if the table was created using > 'serial' ? No. Where the docs say "these are equivalent", they mean that very literally. > The difference we see between

RE: removing "serial" from table definitions.

2021-06-24 Thread Marc Mamin
>serial is not an actual data type -- it is essentially an integer with a >default and an automatically created sequence. See: >> >>https://www.postgresql.org/docs/13/datatype-numeric.html#DATATYPE-SERIA >>L > >Yes, I undersand that serial is just a hint at table creation time, but is >there a pl

RE: removing "serial" from table definitions.

2021-06-24 Thread Marc Mamin
From: Joe Conway [mailto:m...@joeconway.com] >Sent: Donnerstag, 24. Juni 2021 14:47 >To: Marc Mamin ; pgsql-general > >Subject: Re: removing "serial" from table definitions. > >On 6/24/21 8:33 AM, Marc Mamin wrote: >> Hi, >> >> Is there a way to c

Re: removing "serial" from table definitions.

2021-06-24 Thread Joe Conway
On 6/24/21 8:33 AM, Marc Mamin wrote: Hi, Is there  a way to change a data type from serial to int? I tried with :   ALTER TABLE "admin".db_jobs ALTER COLUMN id TYPE int USING id::int; But this seems not to change anything, as if Posgres woud consider the statement as a no-op. serial is n

Re: removing "serial" from table definitions.

2021-06-24 Thread Johannes Paul
>From what I know, serial is just used to setup a table but it is then converted to int in the table. Therefore, you probably cannot remove it since it is not there any more anyway. To setup table with int instead of serial, you could use this: CREATE SEQUENCE table_name_id_seq; CREATE TABLE tab