[GENERAL] Is PRIMARY KEY the same as UNIQUE NOT NULL?

2016-01-30 Thread Ben Leslie
Apologies in advance if this is not the best list for this. Appreciate a redirection if there is something more appropriate. In the document is mentions that: "Technically, PRIMARY KEY is merely a combination of UNIQUE and NOT NULL" I wanted to clarify if that was, technically, true. I had a tab

Re: [GENERAL] Is PRIMARY KEY the same as UNIQUE NOT NULL?

2016-02-07 Thread Ben Leslie
On 8 February 2016 at 08:04, Tom Lane wrote: > Geoff Winkless writes: >> On 31 January 2016 at 19:53, David G. Johnston >> wrote: >>> A PRIMARY KEY enforces a UNIQUE, NOT NULL constraint and additionally allows >> [snip] > >> I would just remove the whole paragraph. A primary key does what it >>

[GENERAL] Isolation of schema renames

2017-08-09 Thread Ben Leslie
I'm wondering if I can/should expect schema renames to be isolated. For example, I have two schemas "test" and "test_new". Each with a "test" table (with same columns, but different data). In one transaction I'm renaming the schemas test => test_old, test_new => test. I.e.: BEGIN; ALTER SCHEMA t

Re: [GENERAL] Isolation of schema renames

2017-08-09 Thread Ben Leslie
On 10 August 2017 at 12:14, Tom Lane wrote: > Ben Leslie writes: Thanks for the quick response, I appreciate it. > I'm wondering if I can/should expect schema renames to be isolated. Nope, you should not. That's fine. I think I can achieve what I want using an alte

Re: [GENERAL] How to check if a table exists

2001-03-07 Thread Ben Leslie
On Wed, 07 Mar 2001, Jeff wrote: > Also how to programmatically check if a table exists in the database? I think the easiest way is to attach to one of the default database like "Template0" i think, then query the system tables. pg_database and pg_class are theones you will be after i think. (