pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #12108: Documentation: Limitation of shell types not mentioned
2+ messages / 2 participants
[nested] [flat]

* BUG #12108: Documentation: Limitation of shell types not mentioned
@ 2014-12-01 00:34  bouda@edookit.com
  0 siblings, 1 reply; 2+ messages in thread

From: bouda@edookit.com @ 2014-12-01 00:34 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      12108
Logged by:          Ondřej Bouda
Email address:      bouda@edookit.com
PostgreSQL version: 9.3.5
Operating system:   Windows 7
Description:        

According to an older discussion [1], shell types may only be used by
functions implemented in C. Indeed, in current versions, functions in, e.g.,
SQL or PL/pgSQL cannot be defined if an argument type or the return type is
just a shell type.

This is not mentioned in the documentation, however. On the contrary, the
CREATE TYPE documentation suggests creating a shell type as the "tricky" way
to define a range type with a canonical function. Neither CREATE FUNCTION
documentation mentions such a limitation. Thus, when implementing an SQL or
PL/pgSQL prototype for some new canonical function, one gets stuck on an
unexpected error.

I suggest mentioning the limitation on the CREATE TYPE page, in the
paragraph saying how to specify the canonical function.


Regards,
Ondřej Bouda


[1]
http://postgresql.nabble.com/Chicken-egg-problem-with-range-types-td5717030.html


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #12108: Documentation: Limitation of shell types not mentioned
@ 2015-03-20 22:50  Bruce Momjian <bruce@momjian.us>
  parent: bouda@edookit.com
  0 siblings, 0 replies; 2+ messages in thread

From: Bruce Momjian @ 2015-03-20 22:50 UTC (permalink / raw)
  To: bouda@edookit.com; +Cc: pgsql-bugs

On Mon, Dec  1, 2014 at 12:34:48AM +0000, bouda@edookit.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      12108
> Logged by:          Ondřej Bouda
> Email address:      bouda@edookit.com
> PostgreSQL version: 9.3.5
> Operating system:   Windows 7
> Description:        
> 
> According to an older discussion [1], shell types may only be used by
> functions implemented in C. Indeed, in current versions, functions in, e.g.,
> SQL or PL/pgSQL cannot be defined if an argument type or the return type is
> just a shell type.
> 
> This is not mentioned in the documentation, however. On the contrary, the
> CREATE TYPE documentation suggests creating a shell type as the "tricky" way
> to define a range type with a canonical function. Neither CREATE FUNCTION
> documentation mentions such a limitation. Thus, when implementing an SQL or
> PL/pgSQL prototype for some new canonical function, one gets stuck on an
> unexpected error.
> 
> I suggest mentioning the limitation on the CREATE TYPE page, in the
> paragraph saying how to specify the canonical function.

I have update the docs with the attached patch.  I also noticed that
there is a sentence down at the bottom saying:

	Also, to avoid accidentally cluttering the catalogs with shell types as
	a result of simple typos in function definitions, a shell type will only
	be made this way when the input function is written in C.

I think this explains why only C functions are supported.

Let me know if you have any additional suggestions.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

shell.diff (text/x-diff, 1.2K) download diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml new file mode 100644 index f9e1297..a6a4644 *** a/doc/src/sgml/ref/create_type.sgml --- b/doc/src/sgml/ref/create_type.sgml *************** CREATE TYPE <replaceable class="paramete *** 268,274 **** placeholder type that has no properties except a name and an owner. This is done by issuing the command <literal>CREATE TYPE <replaceable>name</></literal>, with no additional parameters. Then the ! I/O functions can be defined referencing the shell type. Finally, <command>CREATE TYPE</> with a full definition replaces the shell entry with a complete, valid type definition, after which the new type can be used normally. --- 268,274 ---- placeholder type that has no properties except a name and an owner. This is done by issuing the command <literal>CREATE TYPE <replaceable>name</></literal>, with no additional parameters. Then the ! C I/O functions can be defined referencing the shell type. Finally, <command>CREATE TYPE</> with a full definition replaces the shell entry with a complete, valid type definition, after which the new type can be used normally.
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2015-03-20 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-01 00:34 BUG #12108: Documentation: Limitation of shell types not mentioned bouda@edookit.com
2015-03-20 22:50 ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox