B
B
Banny_Boom2015-07-18 09:01:03
PHP
Banny_Boom, 2015-07-18 09:01:03

How to set a default value in PgSQL?

what is the problem?
why is the default value not being set?
"it is written, etc", it is written that it is not possible to set an integer, but why?
4o5ZTS_Gh04.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2015-07-18
@Rsa97

It is written in English:
The existing values ​​in the ip column cannot be automatically converted to the integer type. Use USING to cast the old type to the new one.

A
Andrew, 2015-07-19
@mblp

ALTER TABLE the_table ALTER COLUMN col_name TYPE integer USING (col_name::integer);

B
Banny_Boom, 2015-07-19
@Banny_Boom

thanks, I already tried it, the trouble is that you can’t translate from cidr to integer, I had to recreate the table, thanks for the help )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question