Why this doesn''t work? ActiveRecord::Base.connection.execute("\\d") ? I use PostgreSQL server and this should be command to get list of all tables within a database. Is there a problem with privileges or PGSQL driver for rails doesn''t support it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6 Mar 2009, at 18:26, Lubomir Herko wrote:> > Why this doesn''t work? > > ActiveRecord::Base.connection.execute("\\d") ? >Because you''re confusing commands the the psql application supports versus actual sql queries you can run. Execute lets you run arbitrary sql expressions, which "\\d" isn''t (it also doesn''t do much with the result for you, so select_all etc... are often more useful if there is data you are trying to get at) Fred (PS: ActiveRecord::Base.connection.tables)> I use PostgreSQL server and this should be command to get list of all > tables within a database. Is there a problem with privileges or PGSQL > driver for rails doesn''t support it? > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 6 Mar 2009, at 18:26, Lubomir Herko wrote: > >> >> Why this doesn''t work? >> >> ActiveRecord::Base.connection.execute("\\d") ? >> > Because you''re confusing commands the the psql application supports > versus actual sql queries you can run. Execute lets you run arbitrary > sql expressions, which "\\d" isn''t (it also doesn''t do much with the > result for you, so select_all etc... are often more useful if there is > data you are trying to get at) > > Fred > > (PS: ActiveRecord::Base.connection.tables)thanks.. I was thinking that .execute() would not work with this level of command-line queries.. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---