Ich habe eine Tabelle mit einer Spalte ohne Null. Wie kann ich einen Nullwert in dieser Spalte als Standard festlegen?
Ich meine, ich möchte so etwas machen:
postgres=# ALTER TABLE person ALTER COLUMN phone SET NULL;
aber es zeigt:
postgres=# ALTER TABLE person ALTER COLUMN phone SET NULL;
ERROR: syntax error at or near "NULL"
LINE 1: ALTER TABLE person ALTER COLUMN phone SET NULL;
ALTER TABLE person ALTER COLUMN phone DROP NOT NULL;
Weitere Details im Handbuch: http://www.postgresql.org/docs/9.1/static/sql-altertable.html
Führen Sie den Befehl in diesem Format aus
ALTER TABLE tablename ALTER COLUMN columnname SET NOT NULL;
zum Setzen der Spalte auf nicht null.
First, Set :
ALTER TABLE person ALTER COLUMN phone DROP NOT NULL;
Führen Sie den Befehl in folgendem Format aus:ALTER [ COLUMN ] column { SET | DROP } NOT NULL