On 7/17/16 2:22 PM, Petr Jelinek wrote:
I generally agree, but I think the more important question is "Why?". Is
it becouse DDL looks more like a sentence? Is it because arrays are a
PITA? Is it too hard to call functions?

For me it's many small reasons. I want to store it in catalogs and some
things there are nicer when you manipulate using standard DDL processing
(like dependencies for example).

Fair point.

The syntax is also bit nicer. Our
documentation works better for DDLs than functions (that's something we
should fix but I am not doing it as part of this patch). Same goes for
psql tab completion. We automatically gain things like event triggers.

I'd think all of those we'd want to be able to support for functions as well...

The support in pg_dump is also more straightforward with DDL.

Hmm... not sure why that is. It does seem to me that support for extension configuration isn't as strong as it could be.

It might make sense to have functions for manipulating slots and origins
as those are just primitives which user should not have to fiddle with
but for things that are directly meant for user interaction DDL just
feels better.

I do agree that DDL "feels better" (which I think is what JD was alluding too).

I had a secret agenda in asking why it's better though: can we find a way to allow extensions to do "DDL-ish" things in a better way than how they're stuck doing them today. I suspect it will never be practical to have extensions modifying grammar willy-nilly, but maybe there's some other things we could do to make life easier. One thought is an "extension command" mode you can enter that means everything you're typing gets treated as a call to a function in that extension:

master_create_distributed_table 'github_events', 'created_at', 'append';

instead of SELECT master_create_distributed_table('github_events', 'created_at', 'append');

obviously that's completely pointless for a single command, but if you needed to do a bunch of things it starts saving typing.
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to