#1  
Old 8th December 2006, 12:16 PM
Ole Willy Tuv
 
Posts: n/a
Default Metadata issue, default column value

I've created a table (test) in EM with the following column descriptors:

col1 ShortString 10, TnxEmptyDefaultValueDescriptor
col2 NullString 10, TnxEmptyDefaultValueDescriptor
col3 GUID, TnxAutoGuidDefaultDescriptor
col4 DateTime, TnxCurrentDateTimeDefaultValueDescriptor
col5 NullString 20, TnxCurrentUserDefaultValueDescriptor

Checking the column descriptors in the #FIELDS system table, the
FIELD_DEFAULTVALUE column shows the following values:

<Empty>
<Empty>
NEWGUID
CURRENT_DATETIME
CURRENT_USER

Only NEWGUID and CURRENT_USER are valid values. <Empty> and CURRENT_DATETIME
are invalid default options.

Opening the table in the table editor in Database Workbench, the DDL looks
like:

CREATE TABLE test
(
col1 ShortString(10) DEFAULT <Empty>,
col2 VarChar(10) DEFAULT '<Empty>',
col3 GUID DEFAULT NEWGUID,
col4 Timestamp DEFAULT 'CURRENT_DATETIME',
col5 VarChar(20) DEFAULT CURRENT_USER
);

This statement won't execute, of course, because of the invalid default
specifications, but what's rather weird is that <Empty> is parsed as a
character string literal in the col2 (VARCHAR) column and as a keyword in
the col1 (SHORTSTRING) column.

Anyhow, the main issue is the bug in the creation of the system table.

Ole


  #2  
Old 8th December 2006, 01:15 PM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: Metadata issue, default column value

> Only NEWGUID and CURRENT_USER are valid values. <Empty> and
> CURRENT_DATETIME are invalid default options.


Issue #2284

> This statement won't execute, of course, because of the invalid
> default specifications, but what's rather weird is that <Empty> is
> parsed as a character string literal in the col2 (VARCHAR) column and
> as a keyword in the col1 (SHORTSTRING) column.


That has to be a DBW thing.

--

Eivind Bakkestuen
Nexus Database Systems Pty Ltd


  #3  
Old 8th December 2006, 08:39 PM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata issue, default column value

Eivind,

> Issue #2284


Additional issue:

If a TnxConstDefaultValueDescriptor is defined on a character string column,
the default value shown in #FIELDS.FIELD_DEFAULTVALUE shall be quoted.
Currently it shows up without the quotes.

The point is that the representation of default values in the relevant
system tables/views (the proprietary #FIELDS table in V2, the standard
INFORMATION_SCHEMA.COLUMNS in V3), shall be exactly how it appears in SQL
text.

For example, the default character string value 'Empty' shall appear as
'Empty' in the system table, not as Empty.

Ole


  #4  
Old 9th December 2006, 12:04 AM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: Metadata issue, default column value

> Additional issue:

added

--

Eivind Bakkestuen
Nexus Database Systems Pty Ltd


  #5  
Old 8th December 2006, 08:39 PM
Martijn Tonies
 
Posts: n/a
Default Re: Metadata issue, default column value

> > Only NEWGUID and CURRENT_USER are valid values. <Empty> and
> > CURRENT_DATETIME are invalid default options.

>
> Issue #2284
>
> > This statement won't execute, of course, because of the invalid
> > default specifications, but what's rather weird is that <Empty> is
> > parsed as a character string literal in the col2 (VARCHAR) column and
> > as a keyword in the col1 (SHORTSTRING) column.

>
> That has to be a DBW thing.


http://tracker.upscene.com/view.php?id=765


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


  #6  
Old 8th December 2006, 09:35 PM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata issue, default column value

Martijn,

>> That has to be a DBW thing.

>
> http://tracker.upscene.com/view.php?id=765


Actually, there should be no requirement for DBW to add quotes to default
values. DBW should simply grab the default specification from the
appropriate system table. This requires that NDS fixes the default value
metadata issues though.

Ole


  #7  
Old 8th December 2006, 09:38 PM
Martijn Tonies
 
Posts: n/a
Default Re: Metadata issue, default column value

> >> That has to be a DBW thing.
> >
> > http://tracker.upscene.com/view.php?id=765

>
> Actually, there should be no requirement for DBW to add quotes to default
> values. DBW should simply grab the default specification from the
> appropriate system table. This requires that NDS fixes the default value
> metadata issues though.


I'm doing all sort of funky stuff there, also to recognize empty strings and
so on.

I hope this won't be changed for v2.x...

DBW is fine now.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


  #8  
Old 8th December 2006, 09:55 PM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata issue, default column value

Martijn,

<< I'm doing all sort of funky stuff there, also to recognize empty strings
and so on. >>

Wouldn't it be much easier to just grab the default specification from the
metadata table ? This is how SQL clients are supposed to access it.

How would you determine whether the value Empty in
#FIELDS.FIELD_DEFAULTVALUE represents a constant (character string literal
'Empty') or the keyword EMPTY ?

Ole


  #9  
Old 9th December 2006, 12:02 AM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: Metadata issue, default column value

> I hope this won't be changed for v2.x...

I think we will, unless there's a compelling reason not to?

--

Eivind Bakkestuen
Nexus Database Systems Pty Ltd


  #10  
Old 14th December 2006, 12:59 PM
Thorsten Engler
 
Posts: n/a
Default Re: Metadata issue, default column value

Eivind Bakkestuen [NDD] wrote:

> >Only NEWGUID and CURRENT_USER are valid values. <Empty> and
> > CURRENT_DATETIME are invalid default options.

>
> Issue #2284

Fixed. (EMPTY and CURRENT_TIMESTAMP now)

--



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata using SQL Hans Hasenack nexusdb.public.support.sql 8 29th September 2006 05:43 PM
Metadata query returns wrong results Martijn Tonies nexusdb.public.support.sql 4 13th September 2006 01:55 AM
Default Index Value Jean-Francois Nifenecker nexusdb.public.support.sql 2 11th June 2004 08:33 PM
Setting default values TC nexusdb.public.support.sql 1 12th December 2003 09:53 PM
Metadata - DataDictionary Ole Willy Tuv nexusdb.public.support.sql 1 2nd October 2003 03:57 PM


All times are GMT +11. The time now is 09:04 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.