Re: SQL equivalint of #incude directive ?
От | Francisco Olarte |
---|---|
Тема | Re: SQL equivalint of #incude directive ? |
Дата | |
Msg-id | CA+bJJbx=QbMx+z_8AH4h=E-bfPbsBmUaU4PtD11F13bLMpppjw@mail.gmail.com обсуждение исходный текст |
Ответ на | SQL equivalint of #incude directive ? (stan <stanb@panix.com>) |
Ответы |
Re: SQL equivalint of #incude directive ?
|
Список | pgsql-general |
Stan: On Fri, Aug 30, 2019 at 3:49 PM stan <stanb@panix.com> wrote: ... > I am defining a bunch of functions, and I would prefer to store them in a > separate file, which then gets "source" by the main DB init file. > Is there a standard way to do this? I assume you mean "standard for postgres", AFAIK there is not even a (multidb) standard way to feed an sql script to a server (content of queries / results are standard, how to send them / get them from the server is not ). \i in psql has been pointed. I do not know if this is one of your "workarounds", but what I normally do for this is trat the "init" script as a program and "make" it. I've done it using many of the preprocessor freely available around ( i.e. m4, cpp ) and also using a perl program ( but this is becuase I'm quite fluent in it and it makes some thing easier ), and even doing "cat *.sql | psql" and naming the scripts appropiately. You'll probably have it easier going by that route ( generating the sql script from chunks using a tool of your choice, it's just a big text chunk and you can easily debug it with a text editor ), and it is not that complex. Francisco Olarte.
В списке pgsql-general по дате отправления: