Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 7788

Data Definition Language; defining database structures but not their contents.

6 votes
Accepted

Replication and table locks during alter table

Would it make sense to explore a replicated PG setup (master-slave perhaps), where all writes and migrations are executed against the master, and all high volume reads are executed against the slav …
Craig Ringer's user avatar
  • 57.3k
7 votes
Accepted

Does PostgreSQL support online schema modification (DDL)?

TL;DR: No, except for some basic cases. Some lock-strength reductions for ALTER TABLE have been added to PostgreSQL 9.5. You can't do anything that requires a full table rewrite without an exclusive …
Craig Ringer's user avatar
  • 57.3k
4 votes

Use composite type to create new table

I'm not sure if you want to create a table with a given composite type (as Erwin describes) or one containing a composite type. If the latter, it's almost the same. create type typename as( ...) t …
Craig Ringer's user avatar
  • 57.3k
11 votes
Accepted

PostgreSQL GRANT ALL on mutliple tables using LIKE

See many related answers here on DBA.se and Stack Overflow for dynamic DDL in PL/PgSQL. …
Craig Ringer's user avatar
  • 57.3k
5 votes

Constraint to enforce "at least one" or "exactly one" in a database

The only way to do either of these without schema changes is with a PL/PgSQL trigger. For the "exactly one" case, you can make the references mutual, with one being DEFERRABLE INITIALLY DEFERRED. So …
Craig Ringer's user avatar
  • 57.3k
2 votes
Accepted

Idempotent PostgreSQL schema dump that can be applied to an existing DB

I wonder if there's a simple way to produce DDL that is idempotent There is not, and it doesn't make much sense for a schema with data in it. …
Craig Ringer's user avatar
  • 57.3k