RFC - change of behaviour of pg_get_userbyid & pg_get_viewdef?
Two routines do eccentric things when they can't find required supporting
data:
pg_get_userbyid
returns 'unknown (UID=<uid-number>)' when the UID does not exist.
pg_get_viewdef
returns 'Not a view' when passed a non-existant or non-view table
it also signals errors when the underlying metadata can not be found.
The proposal is to return NULL in the above cases - in the final case,
probably also generate a NOTICE.
Does anybody have a problem with this? Think it's a bad idea etc?
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
Philip Warner <pjw@rhyme.com.au> writes:
pg_get_viewdef
returns 'Not a view' when passed a non-existant or non-view table
it also signals errors when the underlying metadata can not be found.
The proposal is to return NULL in the above cases - in the final case,
probably also generate a NOTICE.
I don't believe it's practical to trap errors and return a NULL for
broken views. Moreover, I do not think it's a good idea to respond
to client errors (invalid view name) the same as database problems
(broken views). So, I agree with the part of the proposal that says
to return NULL instead of 'Not a view' when there is no view by the
given name, but I do not agree with trying to suppress errors due to
metadata problems.
regards, tom lane
On Sun, 24 Sep 2000, Philip Warner wrote:
Two routines do eccentric things when they can't find required supporting
data:pg_get_userbyid
returns 'unknown (UID=<uid-number>)' when the UID does not exist.
[Snip]
The proposal is to return NULL in the above cases - in the final case,
probably also generate a NOTICE.
In these cases, is NULL = 0? - What if it returns the UID for "root"
(typically UID 0)... I think an error message should/would be better in
this case.
Just my $.02.
--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/
At 19:22 24/09/00 -0500, Dominic J. Eidson wrote:
In these cases, is NULL = 0? - What if it returns the UID for "root"
(typically UID 0)... I think an error message should/would be better in
this case.
No NULL is NULL, a special value that usually means 'nothing found'.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
-Hello
- If you want the default value to be "0" the code for that is
default = '0'
Like so
CREATE TABLE Customer (Customer_ID INT Default = '0',
I believe this should work.
dannyh
dannyh@idx.com.au
Show quoted text
On Mon, 25 Sep 2000, Philip Warner wrote:
At 19:22 24/09/00 -0500, Dominic J. Eidson wrote:
In these cases, is NULL = 0? - What if it returns the UID for "root"
(typically UID 0)... I think an error message should/would be better in
this case.No NULL is NULL, a special value that usually means 'nothing found'.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
Based on the lack of reaction on GENERAL and SQL, I am inclined to go ahead
with the
changes below at least as far as returning NULL instead of 'Not a View' or
'unknown (UID=<uid-number>)' (as per Tom's request), if noone objects...
At 13:15 24/09/00 +1000, Philip Warner wrote:
Two routines do eccentric things when they can't find required supporting
data:pg_get_userbyid
returns 'unknown (UID=<uid-number>)' when the UID does not exist.
pg_get_viewdef
returns 'Not a view' when passed a non-existant or non-view table
it also signals errors when the underlying metadata can not be found.The proposal is to return NULL in the above cases - in the final case,
probably also generate a NOTICE.Does anybody have a problem with this? Think it's a bad idea etc?
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/