Thread: SQL Spec Compliance Questions

SQL Spec Compliance Questions

From
Josh Berkus
Date:
Folks,

Just got this "do we support it" questionnaire from a signficant commercial
entity vaguely interested in supporting PostrgreSQL.    Since I'm often foggy
on the differences between the SQL99 and SQL92 spec definitions of things, I
thought I'd post it for feedback here:

1) SQL-92 SELECT, INSERT, UPDATE, DELETE
2) SQL-92 CREATE/DROP SCHEMA/TABLE
3) SQL-92 INFORMATION_SCHEMA or SQL/CLI or ODBC driver with metadata functions
4) SQL-99 CREATE TRIGGER/DROP TRIGGER
5) SQL-99 BLOB, CLOB Data Types up to 1MB
6) SQL-99 Distinct Types
7) SQL-99 Structured Types
8) SQL-99 Functions, Methods, Procedures
9) SQL-99 Collection Types
10) SQL-99 Typed tables and views
11) SQL-99 Recursion
12) SQL/CLI or ODBC driver supports asynchronous statement execution
13) SQL/CLI or ODBC driver Supports all required SQL features
14) Transaction management functions—begin transaction, commit, abort
15) Wire protocol documentation and software

My answers:

1) Yes
2) yes
3) Yes -- INFORMATION_SCHEMA
4) Yes, unless SQL99 has some wierd twist on triggers.
6), 7) Not sure what these are.
8) Functions, yes, and in PostgreSQL functions are capable of acting as
procedures.
9) ???
10) Also not sure
11) In development, expected within the next two versions.  Currently we have
non-SQL-standard recursion by several methods.
12) No
13) Not sure.
14) Yes
15) I think so.

Feedback, please!

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Re: SQL Spec Compliance Questions

From
Tom Lane
Date:
Josh Berkus <josh@agliodbs.com> writes:
> Just got this "do we support it" questionnaire from a signficant commercial
> entity vaguely interested in supporting PostrgreSQL.

This looks more like an underling with a checklist than a serious
inquiry.  Can you get them to specify particular capabilities that they
need?  In sufficient detail that we could actually answer?

            regards, tom lane

Re: SQL Spec Compliance Questions

From
Josh Berkus
Date:
Tom,

> This looks more like an underling with a checklist than a serious
> inquiry.  Can you get them to specify particular capabilities that they
> need?  In sufficient detail that we could actually answer?

I'll ask, but I'm not sure that I can.   The particular company is very
bureaucratic, and I doubt the person who asked me has any control over the
questionnaire.

--
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology     josh@agliodbs.com
    and data management solutions     (415) 565-7293
   for law firms, small businesses      fax 651-9224
    and non-profit organizations.     San Francisco


Re: SQL Spec Compliance Questions

From
Josh Berkus
Date:
Tom,

> This looks more like an underling with a checklist than a serious
> inquiry.  Can you get them to specify particular capabilities that they
> need?  In sufficient detail that we could actually answer?

Ok, talked with him.   They are trying to plan OO-->DB mapping in 3
programming languages for a large project.   Large enough that they would
cost out implementing these SQL99 features for us if they like PostgreSQL
otherwise.    But they *do* need to complete the checklist for each candidate
database system.

So ... can anyone more familiar with SQL99 than me give some feedback?

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Joe Conway
Date:
Josh Berkus wrote:

> 6) SQL-99 Distinct Types
> 7) SQL-99 Structured Types

> 9) SQL-99 Collection Types

> 10) SQL-99 Typed tables and views

> My answers:
>
> 6), 7) Not sure what these are.
Here's the section in SQL99:

4.8 User-defined types
     A user-defined type is a schema object, identified by a
     <user-defined type name>. The definition of a user-defined type
     specifies a number of components, including in particular a list of
     attribute definitions. Although the attribute definitions are said
     to define the representation of the userdefined type, in fact they
     implicitly define certain functions (observers and mutators) that
     are part of the interface of the user-defined type; physical
     representations of user-defined type values are
     implementation-dependent.

     The representation of a user-defined type is expressed either as a
     single data type (some predefined data type, called the source
     type), in which case the user-defined type is said to be a distinct
     type, or as a list of attribute definitions, in which case it is
     said to be a structured type.

So if I read that correctly, they are user defined types, that are
either scalar (distinct) or composite (structured) -- so I'd say yes.

> 9) ???

 From SQL99:

4.11 Collection types
      A collection is a composite value comprising zero or more elements
      each a value of some data type DT. If the elements of some
      collection C are values of DT, then C is said to be a collection of
      DT. The number of elements in C is the cardinality of C. The term
      ‘‘element’’ is not further defined in this part of ISO/IEC 9075.
      The term ‘‘collection’’ is generic, encompassing various types (of
      collection) in connection with each of which, individually, this
      part of ISO/IEC 9075 defines primitive type constructors and
      operators. This part of ISO/IEC 9075 supports one collection type,
      arrays.

We are not yet fully compliant with SQL99 arrays, but not too far off
either, I think. We have some extensions to SQL99 behavior, that would
require breaking backward compatibility in order to do away with them.
For example, SQL99 arrays *always* start with a lower bound of 1, if I
read the spec correctly. Also multidimensional arrays in SQL99 are
"arrays of arrays", which is not quite the same as our multidimensional
arrays.

> 10) Also not sure

SQL99:

4.16.2 Referenceable tables, subtables, and supertables
        A table BT whose row type is derived from a structured type ST is
        called a typed table. Only a base table or a view can be a typed
        table. A typed table has columns corresponding, in name and
        declared type, to every attribute of ST and one other column REFC
        that is the self-referencing column of BT; let REFCN be the
        <column name> of REFC. The declared type of REFC is necessarily
        REF(ST) and the nullability characteristic of REFC is known not
        nullable. If BT is a base table, then the table constraint
        ‘‘UNIQUE(REFCN)’’ is implicit in the definition of BT. A typed
        table is called a referenceable table. A self-referencing column
        cannot be updated. Its value is determined during the insertion
        of a row into the referenceable table. The value of a
        system-generated selfreferencing column and a derived
        self-referencing column is automatically generated when the row
        is inserted into the referenceable table. The value of a
        user-generated self-referencing column is supplied as part of the
        candidate row to be inserted into the referenceable table.

I really don't quite understand this, but I don't think we have it ;-)

HTH,

Joe


Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Josh Berkus
Date:
Joe,

> After re-reading it, I think it is related to (or at least similar to)
> the work Tom is currently doing to allow composite types as table
> attributes.

That's what I thought at first as well, and told the requestor that we would
support them in the next two versions.   But reading that paragraph makes me
think that the type is somehow supposed to contain metadata or summary data
for the table itself.

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Joe Conway
Date:
Josh Berkus wrote:
>>4.16.2 Referenceable tables, subtables, and supertables
>>        A table BT whose row type is derived from a structured type ST is
>>        called a typed table. Only a base table or a view can be a typed
>>        table. A typed table has columns corresponding, in name and
>>        declared type, to every attribute of ST and one other column REFC
>>        that is the self-referencing column of BT; let REFCN be the
>>
>>I really don't quite understand this, but I don't think we have it ;-)
> Was the SQL99 Committee smoking crack, or what?    What the heck is that
> *for*?

After re-reading it, I think it is related to (or at least similar to)
the work Tom is currently doing to allow composite types as table
attributes.

Joe

Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Josh Berkus
Date:
Joe,

Thanks for your help!

> 4.16.2 Referenceable tables, subtables, and supertables
>         A table BT whose row type is derived from a structured type ST is
>         called a typed table. Only a base table or a view can be a typed
>         table. A typed table has columns corresponding, in name and
>         declared type, to every attribute of ST and one other column REFC
>         that is the self-referencing column of BT; let REFCN be the
>
> I really don't quite understand this, but I don't think we have it ;-)

Ye Gods and Little Fishes!!

Was the SQL99 Committee smoking crack, or what?    What the heck is that
*for*?

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Tom Lane
Date:
Joe Conway <mail@joeconway.com> writes:
>>> 4.16.2 Referenceable tables, subtables, and supertables
>>> A table BT whose row type is derived from a structured type ST is
>>> called a typed table. Only a base table or a view can be a typed
>>> table. A typed table has columns corresponding, in name and
>>> declared type, to every attribute of ST and one other column REFC
>>> that is the self-referencing column of BT; let REFCN be the

> After re-reading it, I think it is related to (or at least similar to)
> the work Tom is currently doing to allow composite types as table
> attributes.

The "structured type" stuff seems closely related, but I do not
understand the business about a "self-referencing column".  I have a
feeling that it might be a mutant version of our notion of inheritance
...

            regards, tom lane

Re: [pgsql-advocacy] SQL Spec Compliance Questions

From
Peter Eisentraut
Date:
Josh Berkus wrote:
> > 4.16.2 Referenceable tables, subtables, and supertables
> >         A table BT whose row type is derived from a structured type
> > ST is called a typed table. Only a base table or a view can be a
> > typed table. A typed table has columns corresponding, in name and
> > declared type, to every attribute of ST and one other column REFC
> > that is the self-referencing column of BT; let REFCN be the
> >
> > I really don't quite understand this, but I don't think we have it
> > ;-)
>
> Ye Gods and Little Fishes!!
>
> Was the SQL99 Committee smoking crack, or what?    What the heck is
> that *for*?

Object/relational mapping?


Re: SQL Spec Compliance Questions

From
Peter Eisentraut
Date:
Josh Berkus wrote:
> Just got this "do we support it" questionnaire from a signficant
> commercial entity vaguely interested in supporting PostrgreSQL.
> Since I'm often foggy on the differences between the SQL99 and SQL92
> spec definitions of things, I thought I'd post it for feedback here:

The list of supported features can be found here:
http://www.postgresql.org/docs/7.4/static/features.html