Make it recognize not null constraints and set type to Unknown when the value is not recognized.
Note column not null constraints where not stored in pg_constraint before postgresl 18
This commit is contained in:
parent
cf7c0699fe
commit
c1a5ac1aad
4 changed files with 24 additions and 2 deletions
|
|
@ -24,6 +24,12 @@ void operator<<(ConstraintType &s, const Pgsql::Value &v)
|
|||
case 'x':
|
||||
s = ConstraintType::ExclusionConstraint;
|
||||
break;
|
||||
case 'n':
|
||||
s = ConstraintType::NotNull;
|
||||
break;
|
||||
default:
|
||||
s = ConstraintType::Unknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +55,10 @@ QString ShortNameForConstraintType(ConstraintType ct)
|
|||
case ConstraintType::ExclusionConstraint:
|
||||
s = "XC";
|
||||
break;
|
||||
default:
|
||||
case ConstraintType::NotNull:
|
||||
s = "NN";
|
||||
break;
|
||||
default:
|
||||
s = "?";
|
||||
break;
|
||||
}
|
||||
|
|
@ -78,6 +87,9 @@ QString LongNameForConstraintType(ConstraintType ct)
|
|||
case ConstraintType::ExclusionConstraint:
|
||||
s = "exclusion constraint";
|
||||
break;
|
||||
case ConstraintType::NotNull:
|
||||
s = "not null";
|
||||
break;
|
||||
default:
|
||||
s = "?";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@
|
|||
#include <vector>
|
||||
|
||||
enum class ConstraintType {
|
||||
Unknown, // not recognized, new???
|
||||
PrimaryKey, // p
|
||||
ForeignKey, // f
|
||||
Unique, // u
|
||||
Check, // c
|
||||
ConstraintTrigger, // t
|
||||
ExclusionConstraint, // x
|
||||
NotNull, // n
|
||||
};
|
||||
|
||||
void operator<<(ConstraintType &s, const Pgsql::Value &v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue