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 2639

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

2 votes

CREATE TABLE LIKE another table but with additional columns

No, there is no more succinct method of doing it. But ALTER TABLE can accept multiple arguments, ALTER TABLE foo ADD column bar int, ADD column baz int; Really if your goal is succinct, SQL is …
Evan Carroll's user avatar
  • 64.6k
1 vote

What configurations affect the speed of DDL statements in PostgreSQL

In what sense is database integrity not important? Even if you don't care about integrity, if the production database doesn't accept entries in table baz because of a foreign key constraint against ta …
Evan Carroll's user avatar
  • 64.6k
0 votes

Making a domain conditional on other values in the table

As a side note, it may help to think of it like this Table check constraints - used to ensure data validity on the row and all of the rows columns. Domain constraints - used to ensure data validity …
Evan Carroll's user avatar
  • 64.6k
17 votes

Does PostgreSQL optimize adding columns with non-NULL DEFAULTs?

Yes, with PostgreSQL 11 This feature is new and landed in Version 11. ALTER TABLE your_table ADD COLUMN new_column integer NOT NULL DEFAULT 0; The above is one such command that will be affec …
Evan Carroll's user avatar
  • 64.6k
30 votes

MATCH FULL vs MATCH SIMPLE in foreign key constraints

FULL vs SIMPLE vs PARTIAL While the chosen answer is correct, if this is new to you, you may want to see it with code -- I think it's easier to grok that way. -- one row with (1,1) CREATE TABLE foo …
Evan Carroll's user avatar
  • 64.6k
3 votes
Accepted

PostgreSQL event trigger to force extension installations into particular schema

From the docs, Similarly, if a ddl_command_end trigger fails with an error, the effects of the DDL statement will be rolled back, just as they would be in any other case where the containing transaction …
Evan Carroll's user avatar
  • 64.6k
3 votes

Postgres Transaction OOM on 100k DDL statements

A better idea entirely is to use SQL Server FDW which actually has the logic to pull in Microsoft SQL Server into PostgreSQL format (for example, Bit gets mapped to Bool). From this point Then every …
Evan Carroll's user avatar
  • 64.6k