Re: [HACKERS] named generic constraints [feature request]

2009-12-06 Thread Caleb Cushing
no - -- is line comment in SQL - it same like // in C++ sorry didn't see this was updated. I know -- is a comment I mean in sql means NOT your function name is emptystr which implies it looks for an emptystr and returns true if the string is found to be empty (at least in my mind). so if you

Re: [HACKERS] named generic constraints [feature request]

2009-12-06 Thread Pavel Stehule
2009/12/7 Caleb Cushing xenoterrac...@gmail.com: no - -- is line comment in SQL - it same like // in C++ sorry didn't see this was updated. I know -- is a comment I mean in sql means NOT your function name is emptystr which implies it looks for an emptystr and returns true if the string

[HACKERS] named generic constraints [feature request]

2009-11-23 Thread Caleb Cushing
So last time I checked this wasn't possible (at least not that anyone has told me). I'd like to be able to create constraints that aren't tied to a specific table/column. I think that the syntax would look something like this CREATE CONSTRAINT empty CHECK (VALUE = '\0' ); this should allow us

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Pavel Stehule
Hello do you know domains? It is very similar to your proposal. http://www.postgresql.org/docs/8.2/static/sql-createdomain.html Regards Pavel Stehule 2009/11/23 Caleb Cushing xenoterrac...@gmail.com: So last time I checked this wasn't possible (at least not that anyone has told me). I'd like

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Caleb Cushing
On Mon, Nov 23, 2009 at 4:17 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hello do you know domains? It is very similar to your proposal. obviously since I cited it. constraint cannot be  part of  expression. why not? NOT NULL is a contraint, UNIQUE is a contstraint. CREATE OR

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Pavel Stehule
2009/11/23 Caleb Cushing xenoterrac...@gmail.com: On Mon, Nov 23, 2009 at 4:17 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hello do you know domains? It is very similar to your proposal. obviously since I cited it. constraint cannot be  part of  expression. why not? NOT NULL is a

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Peter Eisentraut
On mån, 2009-11-23 at 12:50 -0500, Caleb Cushing wrote: and domains only seem right if it's something, like a zip code, that has a very specific set of rules, that is in reality it's own type. A domain is not really its own type, it's a domain over its base type. Hence the name. where

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Caleb Cushing
CREATE OR REPLACE FUNCTION emptystr(text) RETURNS bool AS $$  SELECT $1 ''; -- it is SQL not C $$ LANGUAGE sql; CREATE TABLE users(  username TEXT CHECK (NOT emptystr(username)), although I'm not going to continue discussing the request. this code as the opposite desired effect. it should

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Josh Berkus
Caleb, I can understand why you want this. However, it would be tricky to implement because of data typing, and is fairly easily worked around using either domains or functions. So I don't think anyone is going to want to add it to the TODO list, sorry. Of course, Postgres is fully hackable if

Re: [HACKERS] named generic constraints [feature request]

2009-11-23 Thread Pavel Stehule
2009/11/24 Caleb Cushing xenoterrac...@gmail.com: CREATE OR REPLACE FUNCTION emptystr(text) RETURNS bool AS $$  SELECT $1 ''; -- it is SQL not C $$ LANGUAGE sql; CREATE TABLE users(  username TEXT CHECK (NOT emptystr(username)), although I'm not going to continue discussing the request.