Re: Compile query results into a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 16, 2020 at 4:22 PM Santosh Udupi <email@xxxxxxxxx> wrote:


Sample calls to the function:

 // select * from dbo. test  ('search_in_authors')

// select * from dbo. test ('search_in_authors, search_in_editors')

// select * from dbo. test ('search_in_authors, search_in_editors,search_in_publishers ')

-----------------------------------------------------

 Are there any options in PostgreSQL to achieve this other than using a temp table ?

Since the names of the tables are dynamic you would need to use pl/pgsql and its EXECUTE capability and build up a useful SQL command on-the-fly.  To avoid using temporary tables you would need to put all the separate queries into the same main query.  This can be done with "UNION" and/(or?) Common Table Expressions (CTE - the WITH clause).

David J.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux